diff --git a/Cargo.toml b/Cargo.toml index 9b72fc4b..5a01463f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,11 +21,15 @@ dbg-macro = "warn" manual-string-new = "warn" uninlined-format-args = "warn" use-self = "warn" +redundant-clone = "warn" +# until is fixed +literal-string-with-formatting-args = "allow" [workspace.lints.rust] -rust-2018-idioms = "deny" +rust-2018-idioms = "warn" # unreachable-pub = "warn" -unused-must-use = "deny" +unused-must-use = "warn" +redundant-lifetimes = "warn" [workspace.lints.rustdoc] all = "warn" diff --git a/crates/artifacts/solc/src/remappings.rs b/crates/artifacts/solc/src/remappings.rs index 8b107a0d..3fd74964 100644 --- a/crates/artifacts/solc/src/remappings.rs +++ b/crates/artifacts/solc/src/remappings.rs @@ -101,8 +101,7 @@ impl FromStr for Remapping { return Err(RemappingError::EmptyRemappingValue(remapping.to_string())); } // if the remapping just starts with : (no context name), treat it as global - let context = - context.and_then(|c| if c.trim().is_empty() { None } else { Some(c.to_string()) }); + let context = context.filter(|c| !c.trim().is_empty()); Ok(Self { context, name: name.to_string(), path: path.to_string() }) } } diff --git a/crates/compilers/src/cache.rs b/crates/compilers/src/cache.rs index ec224ec1..5fcd95e9 100644 --- a/crates/compilers/src/cache.rs +++ b/crates/compilers/src/cache.rs @@ -680,7 +680,7 @@ impl, C: Compiler> seen_by_compiler: false, }; - self.cache.files.insert(file, entry.clone()); + self.cache.files.insert(file, entry); } /// Returns the set of [Source]s that need to be compiled to produce artifacts for requested diff --git a/crates/compilers/src/compile/project.rs b/crates/compilers/src/compile/project.rs index b64feb53..7764df46 100644 --- a/crates/compilers/src/compile/project.rs +++ b/crates/compilers/src/compile/project.rs @@ -748,7 +748,7 @@ mod tests { fn extra_output_cached() { let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../test-data/dapp-sample"); let paths = ProjectPathsConfig::builder().sources(root.join("src")).lib(root.join("lib")); - let mut project = TempProject::::new(paths.clone()).unwrap(); + let mut project = TempProject::::new(paths).unwrap(); // Compile once without enabled extra output project.compile().unwrap(); diff --git a/crates/compilers/src/compilers/restrictions.rs b/crates/compilers/src/compilers/restrictions.rs index 8d6ab3a1..50101334 100644 --- a/crates/compilers/src/compilers/restrictions.rs +++ b/crates/compilers/src/compilers/restrictions.rs @@ -28,7 +28,7 @@ impl RestrictionsWithVersion { if let Some(self_version) = self.version.as_mut() { self_version.comparators.extend(version.comparators); } else { - self.version = Some(version.clone()); + self.version = Some(version); } } self.restrictions = self.restrictions.merge(other.restrictions)?; diff --git a/crates/compilers/src/resolver/mod.rs b/crates/compilers/src/resolver/mod.rs index d3b70d4e..5953585f 100644 --- a/crates/compilers/src/resolver/mod.rs +++ b/crates/compilers/src/resolver/mod.rs @@ -635,9 +635,9 @@ impl> Graph { if !all_versions.iter().any(|v| req.matches(v.as_ref())) { return if project.offline { - Err(SourceVersionError::NoMatchingVersionOffline(req.clone())) + Err(SourceVersionError::NoMatchingVersionOffline(req)) } else { - Err(SourceVersionError::NoMatchingVersion(req.clone())) + Err(SourceVersionError::NoMatchingVersion(req)) }; } @@ -685,9 +685,7 @@ impl> Graph { { // check if the version is even valid let f = utils::source_name(&failed_node.path, &self.root).display(); - return Err( - format!("Encountered invalid solc version in {f}: {version_err}").to_string() - ); + return Err(format!("Encountered invalid solc version in {f}: {version_err}")); } else { // if the node requirement makes sense, it means that there is at least one node // which requirement conflicts with it @@ -757,9 +755,7 @@ impl> Graph { if all_profiles.is_empty() { let f = utils::source_name(&failed_node.path, &self.root).display(); - return Err( - format!("Missing profile satisfying settings restrictions for {f}").to_string() - ); + return Err(format!("Missing profile satisfying settings restrictions for {f}")); } // iterate over all the nodes once again and find the one incompatible