Skip to content

Commit 0f78197

Browse files
committed
Clippy
1 parent 3faaa02 commit 0f78197

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

crates/compilers/src/cache.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ impl<T: ArtifactOutput<CompilerContract = C::CompilerContract>, C: Compiler>
918918
return true;
919919
};
920920

921-
if entry.interface_repr_hash.as_ref().map_or(true, |h| h != interface_hash) {
921+
if entry.interface_repr_hash.as_ref() != Some(interface_hash) {
922922
trace!("interface hash changed");
923923
return true;
924924
};
@@ -945,11 +945,11 @@ impl<T: ArtifactOutput<CompilerContract = C::CompilerContract>, C: Compiler>
945945
entry.insert(source.content_hash());
946946
}
947947
// Fill interface representation hashes for source files
948-
if self.is_source_file(&file) {
948+
if self.is_source_file(file) {
949949
if let hash_map::Entry::Vacant(entry) =
950950
self.interface_repr_hashes.entry(file.clone())
951951
{
952-
entry.insert(interface_representation_hash(&source, file));
952+
entry.insert(interface_representation_hash(source, file));
953953
}
954954
}
955955
}

crates/compilers/src/preprocessor.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub(crate) fn interface_representation(
8282
}
8383
});
8484

85-
// Return original content if errors.
85+
// Return if any diagnostics emitted during content parsing.
8686
if let Err(err) = sess.emitted_errors().unwrap() {
8787
let e = err.to_string();
8888
trace!("failed parsing {file:?}: {e}");
@@ -167,12 +167,6 @@ impl BytecodeDependencyCollector<'_> {
167167
}
168168

169169
impl Visitor for BytecodeDependencyCollector<'_> {
170-
fn visit_new_expression(&mut self, expr: &NewExpression) {
171-
if let TypeName::UserDefinedTypeName(_) = &expr.type_name {
172-
self.total_count += 1;
173-
}
174-
}
175-
176170
fn visit_function_call(&mut self, call: &FunctionCall) {
177171
let (new_loc, expr) = match &call.expression {
178172
Expression::NewExpression(expr) => (expr.src, expr),
@@ -200,6 +194,12 @@ impl Visitor for BytecodeDependencyCollector<'_> {
200194
});
201195
}
202196

197+
fn visit_new_expression(&mut self, expr: &NewExpression) {
198+
if let TypeName::UserDefinedTypeName(_) = &expr.type_name {
199+
self.total_count += 1;
200+
}
201+
}
202+
203203
fn visit_member_access(&mut self, access: &MemberAccess) {
204204
if access.member_name != "creationCode" {
205205
return;
@@ -305,7 +305,7 @@ impl ContractData<'_> {
305305
let abi_encode_args =
306306
params.parameters.iter().map(|param| format!("args.{}", param.name)).join(", ");
307307

308-
let vm_interface_name = format!("VmContractHelper{}", ast_id);
308+
let vm_interface_name = format!("VmContractHelper{ast_id}");
309309
let vm = format!("{vm_interface_name}(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D)");
310310

311311
let helper = format!(
@@ -380,7 +380,7 @@ impl BytecodeDependencyOptimizer<'_> {
380380
for (path, ast) in &self.asts {
381381
let src = self.sources.get(path).unwrap().content.as_str();
382382

383-
if is_test_or_script(path, &self.paths) {
383+
if is_test_or_script(path, self.paths) {
384384
continue;
385385
}
386386

@@ -428,7 +428,7 @@ impl BytecodeDependencyOptimizer<'_> {
428428
let mut new_sources = Sources::new();
429429
for (id, contract) in contracts {
430430
if let Some(code) = contract.build_helper()? {
431-
let path = format!("foundry-pp/DeployHelper{}.sol", id);
431+
let path = format!("foundry-pp/DeployHelper{id}.sol");
432432
new_sources.insert(path.into(), Source::new(code));
433433
}
434434
}
@@ -444,7 +444,7 @@ impl BytecodeDependencyOptimizer<'_> {
444444
updates: &mut Updates,
445445
) -> Result<()> {
446446
for (path, ast) in &self.asts {
447-
if !is_test_or_script(path, &self.paths) {
447+
if !is_test_or_script(path, self.paths) {
448448
continue;
449449
}
450450
let src = self.sources.get(path).unwrap().content.as_str();

0 commit comments

Comments
 (0)