From e6eb541e5e0bf4e9cbfb77195a911e5a206223a6 Mon Sep 17 00:00:00 2001 From: Rain Date: Mon, 7 Nov 2022 12:56:20 -0800 Subject: [PATCH] [meta] fix clippy issues on Rust 1.65 Does require a (minor) breaking change to guppy. --- guppy/src/errors.rs | 2 +- guppy/src/graph/resolve.rs | 16 ++++++++-------- guppy/src/graph/summaries/package_set.rs | 2 +- tools/determinator/src/rules.rs | 2 +- tools/hakari/src/cli_ops/workspace_ops.rs | 5 ++--- tools/hakari/src/hakari.rs | 2 ++ 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/guppy/src/errors.rs b/guppy/src/errors.rs index e7ec806f36a..a1e68183035 100644 --- a/guppy/src/errors.rs +++ b/guppy/src/errors.rs @@ -63,7 +63,7 @@ pub enum Error { message: String, /// The summary for which the name wasn't recognized. - summary: crate::graph::summaries::ThirdPartySummary, + summary: Box, /// The registry name that wasn't recognized. registry_name: String, diff --git a/guppy/src/graph/resolve.rs b/guppy/src/graph/resolve.rs index 1628189384d..bca0a39c4eb 100644 --- a/guppy/src/graph/resolve.rs +++ b/guppy/src/graph/resolve.rs @@ -304,7 +304,7 @@ impl<'g> PackageSet<'g> { direction: DependencyDirection, mut callback: impl FnMut(PackageMetadata<'g>) -> bool, ) -> Self { - let graph = self.graph; + let graph = *self.graph; let included: IxBitSet = self .packages(direction) .filter_map(move |package| { @@ -316,7 +316,7 @@ impl<'g> PackageSet<'g> { } }) .collect(); - Self::from_included(*graph, included) + Self::from_included(graph, included) } /// Partitions this `PackageSet` into two. @@ -334,7 +334,7 @@ impl<'g> PackageSet<'g> { direction: DependencyDirection, mut callback: impl FnMut(PackageMetadata<'g>) -> bool, ) -> (Self, Self) { - let graph = self.graph; + let graph = *self.graph; let mut left = IxBitSet::with_capacity(self.core.included.len()); let mut right = left.clone(); @@ -346,8 +346,8 @@ impl<'g> PackageSet<'g> { } }); ( - Self::from_included(*graph, left), - Self::from_included(*graph, right), + Self::from_included(graph, left), + Self::from_included(graph, right), ) } @@ -367,7 +367,7 @@ impl<'g> PackageSet<'g> { direction: DependencyDirection, mut callback: impl FnMut(PackageMetadata<'g>) -> Option, ) -> (Self, Self) { - let graph = self.graph; + let graph = *self.graph; let mut left = IxBitSet::with_capacity(self.core.included.len()); let mut right = left.clone(); @@ -380,8 +380,8 @@ impl<'g> PackageSet<'g> { } }); ( - Self::from_included(*graph, left), - Self::from_included(*graph, right), + Self::from_included(graph, left), + Self::from_included(graph, right), ) } diff --git a/guppy/src/graph/summaries/package_set.rs b/guppy/src/graph/summaries/package_set.rs index ac34a09fcb9..05bd0630737 100644 --- a/guppy/src/graph/summaries/package_set.rs +++ b/guppy/src/graph/summaries/package_set.rs @@ -599,7 +599,7 @@ impl<'a> PackageMatcher<'a> { None => { return Err(Error::UnknownRegistryName { message: error_message.to_owned(), - summary: tp_summary.clone(), + summary: Box::new(tp_summary.clone()), registry_name: name.clone(), }); } diff --git a/tools/determinator/src/rules.rs b/tools/determinator/src/rules.rs index 50a1c740d2d..b474cc1012b 100644 --- a/tools/determinator/src/rules.rs +++ b/tools/determinator/src/rules.rs @@ -195,7 +195,7 @@ The latest version of the default rules is available .expect("default rules should parse") }); - &*DEFAULT_RULES + &DEFAULT_RULES } } diff --git a/tools/hakari/src/cli_ops/workspace_ops.rs b/tools/hakari/src/cli_ops/workspace_ops.rs index a24b1e9b35c..66d1519e268 100644 --- a/tools/hakari/src/cli_ops/workspace_ops.rs +++ b/tools/hakari/src/cli_ops/workspace_ops.rs @@ -93,9 +93,8 @@ impl<'g, 'a> WorkspaceOp<'g, 'a> { for (rel_path, contents) in root_files { let abs_path = workspace_root.join(rel_path.as_ref()); let parent = abs_path.parent().expect("abs path should have a parent"); - std::fs::create_dir_all(&parent).map_err(|err| { - ApplyError::io("error creating directories", &parent, err) - })?; + std::fs::create_dir_all(parent) + .map_err(|err| ApplyError::io("error creating directories", parent, err))?; write_contents(contents, &abs_path)?; } diff --git a/tools/hakari/src/hakari.rs b/tools/hakari/src/hakari.rs index bf0332fbe1b..039b49c0d69 100644 --- a/tools/hakari/src/hakari.rs +++ b/tools/hakari/src/hakari.rs @@ -86,6 +86,8 @@ impl<'g> HakariBuilder<'g> { /// Returns the `PackageGraph` used to construct this `Hakari` instance. pub fn graph(&self) -> &'g PackageGraph { + // This is a spurious clippy lint on Rust 1.65.0 + #[allow(clippy::explicit_auto_deref)] *self.graph }