summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml2
-rw-r--r--.github/workflows/build.yml2
-rw-r--r--.travis.yml2
-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
-rw-r--r--core/module_specifier.rs4
8 files changed, 23 insertions, 28 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index c239ea4ab..26a5b28bd 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -13,7 +13,7 @@ environment:
DENO_BUILD_PATH: $(APPVEYOR_BUILD_FOLDER)\target\release
DENO_THIRD_PARTY_PATH: $(APPVEYOR_BUILD_FOLDER)\third_party
RELEASE_ARTIFACT: deno_win_x64.zip
- RUST_VERSION: 1.37.0
+ RUST_VERSION: 1.38.0
RUST_DIR: $(USERPROFILE)\rust-$(RUST_VERSION)
CARGO_HOME: $(RUST_DIR)\cargo
RUSTUP_HOME: $(RUST_DIR)\rustup
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 1bcf8ff21..fc17b23f5 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -28,7 +28,7 @@ jobs:
- name: Install rust
uses: hecrj/setup-rust-action@v1
with:
- rust-version: "1.37.0"
+ rust-version: "1.38.0"
- name: Install python
uses: actions/setup-python@v1
diff --git a/.travis.yml b/.travis.yml
index 82d0bda3c..115df1a30 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,7 +2,7 @@
sudo: false
language: rust
rust:
- - 1.37.0
+ - 1.38.0
git:
depth: 1
env:
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);
}
}
}
diff --git a/core/module_specifier.rs b/core/module_specifier.rs
index 9194b9082..dbab0ce9b 100644
--- a/core/module_specifier.rs
+++ b/core/module_specifier.rs
@@ -78,7 +78,7 @@ impl ModuleSpecifier {
|| specifier.starts_with("./")
|| specifier.starts_with("../")) =>
{
- Err(ImportPrefixMissing(specifier.to_string()))?
+ return Err(ImportPrefixMissing(specifier.to_string()))
}
// 3. Return the result of applying the URL parser to specifier with base
@@ -103,7 +103,7 @@ impl ModuleSpecifier {
// it being relative, always return the original error. We don't want to
// return `ImportPrefixMissing` or `InvalidBaseUrl` if the real
// problem lies somewhere else.
- Err(err) => Err(InvalidUrl(err))?,
+ Err(err) => return Err(InvalidUrl(err)),
};
Ok(ModuleSpecifier(url))