From d97dbd6a94a79a931b98386aab7c0451b674bcd0 Mon Sep 17 00:00:00 2001 From: nils <48135649+Nilstrieb@users.noreply.github.com> Date: Tue, 11 Apr 2023 11:11:54 +0200 Subject: [PATCH] clippy --- src/build.rs | 18 +++++++++--------- src/processor/reaper.rs | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/build.rs b/src/build.rs index d9fc9fe..4d5d4d6 100644 --- a/src/build.rs +++ b/src/build.rs @@ -224,6 +224,13 @@ impl Build { } pub fn get_diags(&self) -> Result<(Vec, Vec)> { + fn grab_rustc_diags(output: &str) -> Result> { + serde_json::Deserializer::from_str(output) + .into_iter::() + .collect::>() + .map_err(Into::into) + } + let inner = &self.inner; fn grab_cargo_diags(output: &str) -> Result> { @@ -234,17 +241,10 @@ impl Build { Ok(messages .into_iter() .filter(|msg| msg.reason == "compiler-message") - .flat_map(|msg| msg.message) + .filter_map(|msg| msg.message) .collect()) } - fn grab_rustc_diags(output: &str) -> Result> { - serde_json::Deserializer::from_str(&output) - .into_iter::() - .collect::>() - .map_err(Into::into) - } - let diags = match &inner.lint_mode { BuildMode::Cargo { subcommand } => { let mut cmd = self.cmd("cargo"); @@ -392,7 +392,7 @@ fn read_script_output<'a>(stdout: &'a str, stderr: &'a str) -> (&'a str, LintMod is_marked_output(stdout) .map(|mode| (stdout, mode)) .or(is_marked_output(stderr).map(|mode| (stderr, mode))) - .unwrap_or_else(|| (stdout, LintMode::Cargo)) + .unwrap_or((stdout, LintMode::Cargo)) } #[cfg(test)] diff --git a/src/processor/reaper.rs b/src/processor/reaper.rs index 56b422d..d0fa1cc 100644 --- a/src/processor/reaper.rs +++ b/src/processor/reaper.rs @@ -76,7 +76,7 @@ impl Minimizer { let desired_suggestions = suggestions .iter() .filter(|sugg| sugg.message.contains("unused import")) - .cloned() + .copied() .cloned() .collect::>(); @@ -300,7 +300,7 @@ impl VisitMut for FindUnusedFunction<'_> { should_retain } _ => true, - }) + }); } syn::visit_mut::visit_item_mod_mut(self, module);