From 4b01ef5c23973406c44e1178ad11afb779f5c5df Mon Sep 17 00:00:00 2001 From: Mathias Lafeldt Date: Mon, 26 Sep 2022 21:52:16 +0200 Subject: [PATCH] chore: use Rust 1.64.0 (#16035) --- cli/lsp/analysis.rs | 10 +++++----- cli/progress_bar.rs | 11 ++++------- cli/tools/fmt.rs | 2 +- cli/tools/lint.rs | 2 +- cli/tsc.rs | 8 ++++---- cli/worker.rs | 4 +--- rust-toolchain.toml | 2 +- 7 files changed, 17 insertions(+), 22 deletions(-) diff --git a/cli/lsp/analysis.rs b/cli/lsp/analysis.rs index 2508862833ac8d..c4b9f0a86d8fa9 100644 --- a/cli/lsp/analysis.rs +++ b/cli/lsp/analysis.rs @@ -30,7 +30,7 @@ use tower_lsp::lsp_types::Range; /// fixes we treat them the same. static FIX_ALL_ERROR_CODES: Lazy> = Lazy::new(|| { - (&[("2339", "2339"), ("2345", "2339")]) + ([("2339", "2339"), ("2345", "2339")]) .iter() .cloned() .collect() @@ -40,7 +40,7 @@ static FIX_ALL_ERROR_CODES: Lazy> = /// multiple fixes available. static PREFERRED_FIXES: Lazy> = Lazy::new(|| { - (&[ + ([ ("annotateWithTypeFromJSDoc", (1, false)), ("constructorForDerivedNeedSuperCall", (1, false)), ("extendsInterfaceBecomesImplements", (1, false)), @@ -54,9 +54,9 @@ static PREFERRED_FIXES: Lazy> = ("addMissingAwait", (1, false)), ("fixImport", (0, true)), ]) - .iter() - .cloned() - .collect() + .iter() + .cloned() + .collect() }); static IMPORT_SPECIFIER_RE: Lazy = diff --git a/cli/progress_bar.rs b/cli/progress_bar.rs index f52d137c2bbb77..36cdff7c66c947 100644 --- a/cli/progress_bar.rs +++ b/cli/progress_bar.rs @@ -121,12 +121,9 @@ impl ProgressBar { pub fn clear(&self) { let mut inner = self.0.lock(); - match inner.pb.as_ref() { - Some(pb) => { - pb.finish_and_clear(); - inner.pb = None; - } - None => {} - }; + if let Some(pb) = inner.pb.as_ref() { + pb.finish_and_clear(); + inner.pb = None; + } } } diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs index f2af48f26b0fb3..832577aa2e1421 100644 --- a/cli/tools/fmt.rs +++ b/cli/tools/fmt.rs @@ -108,7 +108,7 @@ pub async fn format( files .iter() .any(|path| paths.contains(path)) - .then(|| files) + .then_some(files) .unwrap_or_else(|| [].to_vec()) } else { files diff --git a/cli/tools/lint.rs b/cli/tools/lint.rs index 0bee44d4c00517..da5df3a813e69b 100644 --- a/cli/tools/lint.rs +++ b/cli/tools/lint.rs @@ -128,7 +128,7 @@ pub async fn lint(flags: Flags, lint_flags: LintFlags) -> Result<(), AnyError> { files .iter() .any(|path| paths.contains(path)) - .then(|| files) + .then_some(files) .unwrap_or_else(|| [].to_vec()) } else { files diff --git a/cli/tsc.rs b/cli/tsc.rs index 54989a4ed8fa7b..1951c5a101b015 100644 --- a/cli/tsc.rs +++ b/cli/tsc.rs @@ -84,7 +84,7 @@ macro_rules! inc { /// Contains static assets that are not preloaded in the compiler snapshot. pub static STATIC_ASSETS: Lazy> = Lazy::new(|| { - (&[ + ([ ( "lib.dom.asynciterable.d.ts", inc!("lib.dom.asynciterable.d.ts"), @@ -112,9 +112,9 @@ pub static STATIC_ASSETS: Lazy> = inc!("lib.webworker.iterable.d.ts"), ), ]) - .iter() - .cloned() - .collect() + .iter() + .cloned() + .collect() }); /// A structure representing stats from a type check operation for a graph. diff --git a/cli/worker.rs b/cli/worker.rs index f46c2efce7ed51..cc497630ed90e0 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -141,9 +141,7 @@ impl CliMainWorker { }; self.pending_unload = false; - if let Err(err) = result { - return Err(err); - } + result?; self .inner diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 4a6c2662000c08..cc8f987ef34483 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.63.0" +channel = "1.64.0" components = ["rustfmt", "clippy"]