Skip to content

Commit 28f4d0b

Browse files
committed
chore: more lints
1 parent 8c5683d commit 28f4d0b

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed

Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ dbg-macro = "warn"
2121
manual-string-new = "warn"
2222
uninlined-format-args = "warn"
2323
use-self = "warn"
24+
redundant-clone = "warn"
25+
# until <https://github.com/rust-lang/rust-clippy/issues/13885> is fixed
26+
literal-string-with-formatting-args = "allow"
2427

2528
[workspace.lints.rust]
26-
rust-2018-idioms = "deny"
29+
rust-2018-idioms = "warn"
2730
# unreachable-pub = "warn"
28-
unused-must-use = "deny"
31+
unused-must-use = "warn"
32+
redundant-lifetimes = "warn"
2933

3034
[workspace.lints.rustdoc]
3135
all = "warn"

crates/artifacts/solc/src/remappings.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ impl FromStr for Remapping {
101101
return Err(RemappingError::EmptyRemappingValue(remapping.to_string()));
102102
}
103103
// if the remapping just starts with : (no context name), treat it as global
104-
let context =
105-
context.and_then(|c| if c.trim().is_empty() { None } else { Some(c.to_string()) });
104+
let context = context.filter(|c| !c.trim().is_empty());
106105
Ok(Self { context, name: name.to_string(), path: path.to_string() })
107106
}
108107
}

crates/compilers/src/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ impl<T: ArtifactOutput<CompilerContract = C::CompilerContract>, C: Compiler>
680680
seen_by_compiler: false,
681681
};
682682

683-
self.cache.files.insert(file, entry.clone());
683+
self.cache.files.insert(file, entry);
684684
}
685685

686686
/// Returns the set of [Source]s that need to be compiled to produce artifacts for requested

crates/compilers/src/compile/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ mod tests {
748748
fn extra_output_cached() {
749749
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../test-data/dapp-sample");
750750
let paths = ProjectPathsConfig::builder().sources(root.join("src")).lib(root.join("lib"));
751-
let mut project = TempProject::<MultiCompiler>::new(paths.clone()).unwrap();
751+
let mut project = TempProject::<MultiCompiler>::new(paths).unwrap();
752752

753753
// Compile once without enabled extra output
754754
project.compile().unwrap();

crates/compilers/src/compilers/restrictions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl<T: CompilerSettingsRestrictions> RestrictionsWithVersion<T> {
2828
if let Some(self_version) = self.version.as_mut() {
2929
self_version.comparators.extend(version.comparators);
3030
} else {
31-
self.version = Some(version.clone());
31+
self.version = Some(version);
3232
}
3333
}
3434
self.restrictions = self.restrictions.merge(other.restrictions)?;

crates/compilers/src/resolver/mod.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,9 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
635635

636636
if !all_versions.iter().any(|v| req.matches(v.as_ref())) {
637637
return if project.offline {
638-
Err(SourceVersionError::NoMatchingVersionOffline(req.clone()))
638+
Err(SourceVersionError::NoMatchingVersionOffline(req))
639639
} else {
640-
Err(SourceVersionError::NoMatchingVersion(req.clone()))
640+
Err(SourceVersionError::NoMatchingVersion(req))
641641
};
642642
}
643643

@@ -685,9 +685,7 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
685685
{
686686
// check if the version is even valid
687687
let f = utils::source_name(&failed_node.path, &self.root).display();
688-
return Err(
689-
format!("Encountered invalid solc version in {f}: {version_err}").to_string()
690-
);
688+
return Err(format!("Encountered invalid solc version in {f}: {version_err}"));
691689
} else {
692690
// if the node requirement makes sense, it means that there is at least one node
693691
// which requirement conflicts with it
@@ -757,9 +755,7 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
757755

758756
if all_profiles.is_empty() {
759757
let f = utils::source_name(&failed_node.path, &self.root).display();
760-
return Err(
761-
format!("Missing profile satisfying settings restrictions for {f}").to_string()
762-
);
758+
return Err(format!("Missing profile satisfying settings restrictions for {f}"));
763759
}
764760

765761
// iterate over all the nodes once again and find the one incompatible

0 commit comments

Comments
 (0)