summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/flags.rs4
-rw-r--r--cli/resources.rs8
-rw-r--r--cli/source_maps.rs25
-rw-r--r--cli/state.rs4
4 files changed, 18 insertions, 23 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index c816830b6..c8e5c6e31 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -682,8 +682,8 @@ fn parse_script_args(
let matches =
cli_app.get_matches_from_safe(vec!["deno".to_string(), arg.to_string()]);
- if matches.is_ok() {
- flags = parse_flags(&matches.unwrap(), Some(flags));
+ if let Ok(m) = matches {
+ flags = parse_flags(&m, Some(flags));
} else {
argv.push(arg.to_string());
}
diff --git a/cli/resources.rs b/cli/resources.rs
index 0fdb0e182..fc4aa7eb5 100644
--- a/cli/resources.rs
+++ b/cli/resources.rs
@@ -539,13 +539,7 @@ pub fn get_file(rid: ResourceId) -> Result<std::fs::File, ErrBox> {
// Insert the entry back with the same rid.
table.insert(rid, Repr::FsFile(tokio_fs::File::from_std(std_file)));
- if maybe_std_file_copy.is_err() {
- return Err(ErrBox::from(maybe_std_file_copy.unwrap_err()));
- }
-
- let std_file_copy = maybe_std_file_copy.unwrap();
-
- Ok(std_file_copy)
+ maybe_std_file_copy.map_err(ErrBox::from)
}
_ => Err(bad_resource()),
}
diff --git a/cli/source_maps.rs b/cli/source_maps.rs
index b2943cddb..ec96ccf5b 100644
--- a/cli/source_maps.rs
+++ b/cli/source_maps.rs
@@ -110,8 +110,8 @@ pub fn apply_source_map<G: SourceMapGetter>(
// source file map.
let end_column = match v8_exception.end_column {
Some(ec) => {
- if start_column.is_some() {
- Some(ec - (v8_exception.start_column.unwrap() - start_column.unwrap()))
+ if let Some(sc) = start_column {
+ Some(ec - (v8_exception.start_column.unwrap() - sc))
} else {
None
}
@@ -120,16 +120,17 @@ pub fn apply_source_map<G: SourceMapGetter>(
};
// if there is a source line that we might be different in the source file, we
// will go fetch it from the getter
- let source_line = if v8_exception.source_line.is_some()
- && script_resource_name.is_some()
- && line_number.is_some()
- {
- getter.get_source_line(
- &v8_exception.script_resource_name.clone().unwrap(),
- line_number.unwrap() as usize,
- )
- } else {
- v8_exception.source_line.clone()
+ let source_line = match line_number {
+ Some(ln)
+ if v8_exception.source_line.is_some()
+ && script_resource_name.is_some() =>
+ {
+ getter.get_source_line(
+ &v8_exception.script_resource_name.clone().unwrap(),
+ ln as usize,
+ )
+ }
+ _ => v8_exception.source_line.clone(),
};
V8Exception {
diff --git a/cli/state.rs b/cli/state.rs
index 8781a7aaa..6f2c6db8f 100644
--- a/cli/state.rs
+++ b/cli/state.rs
@@ -171,8 +171,8 @@ impl Loader for ThreadSafeState {
if !is_main {
if let Some(import_map) = &self.import_map {
let result = import_map.resolve(specifier, referrer)?;
- if result.is_some() {
- return Ok(result.unwrap());
+ if let Some(r) = result {
+ return Ok(r);
}
}
}