diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/lsp/analysis.rs | 10 | ||||
-rw-r--r-- | cli/progress_bar.rs | 11 | ||||
-rw-r--r-- | cli/tools/fmt.rs | 2 | ||||
-rw-r--r-- | cli/tools/lint.rs | 2 | ||||
-rw-r--r-- | cli/tsc.rs | 8 | ||||
-rw-r--r-- | cli/worker.rs | 4 |
6 files changed, 16 insertions, 21 deletions
diff --git a/cli/lsp/analysis.rs b/cli/lsp/analysis.rs index 250886283..c4b9f0a86 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<HashMap<&'static str, &'static str>> = Lazy::new(|| { - (&[("2339", "2339"), ("2345", "2339")]) + ([("2339", "2339"), ("2345", "2339")]) .iter() .cloned() .collect() @@ -40,7 +40,7 @@ static FIX_ALL_ERROR_CODES: Lazy<HashMap<&'static str, &'static str>> = /// multiple fixes available. static PREFERRED_FIXES: Lazy<HashMap<&'static str, (u32, bool)>> = Lazy::new(|| { - (&[ + ([ ("annotateWithTypeFromJSDoc", (1, false)), ("constructorForDerivedNeedSuperCall", (1, false)), ("extendsInterfaceBecomesImplements", (1, false)), @@ -54,9 +54,9 @@ static PREFERRED_FIXES: Lazy<HashMap<&'static str, (u32, bool)>> = ("addMissingAwait", (1, false)), ("fixImport", (0, true)), ]) - .iter() - .cloned() - .collect() + .iter() + .cloned() + .collect() }); static IMPORT_SPECIFIER_RE: Lazy<Regex> = diff --git a/cli/progress_bar.rs b/cli/progress_bar.rs index f52d137c2..36cdff7c6 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 f2af48f26..832577aa2 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 0bee44d4c..da5df3a81 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 54989a4ed..1951c5a10 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<HashMap<&'static str, &'static str>> = Lazy::new(|| { - (&[ + ([ ( "lib.dom.asynciterable.d.ts", inc!("lib.dom.asynciterable.d.ts"), @@ -112,9 +112,9 @@ pub static STATIC_ASSETS: Lazy<HashMap<&'static str, &'static str>> = 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 f46c2efce..cc497630e 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 |