diff --git a/crates/artifacts/solc/src/bytecode.rs b/crates/artifacts/solc/src/bytecode.rs index edbd3b32..eb6985ff 100644 --- a/crates/artifacts/solc/src/bytecode.rs +++ b/crates/artifacts/solc/src/bytecode.rs @@ -303,7 +303,7 @@ impl BytecodeObject { /// /// See also: pub fn link_fully_qualified(&mut self, name: &str, addr: Address) -> &mut Self { - if let Self::Unlinked(ref mut unlinked) = self { + if let Self::Unlinked(unlinked) = self { let place_holder = utils::library_hash_placeholder(name); // the address as hex without prefix let hex_addr = hex::encode(addr); diff --git a/crates/artifacts/solc/src/contract.rs b/crates/artifacts/solc/src/contract.rs index a2ae0a6d..fcc2ea2c 100644 --- a/crates/artifacts/solc/src/contract.rs +++ b/crates/artifacts/solc/src/contract.rs @@ -48,7 +48,7 @@ pub struct Contract { impl<'a> From<&'a Contract> for CompactContractBytecodeCow<'a> { fn from(artifact: &'a Contract) -> Self { - let (bytecode, deployed_bytecode) = if let Some(ref evm) = artifact.evm { + let (bytecode, deployed_bytecode) = if let Some(evm) = &artifact.evm { ( evm.bytecode.clone().map(Into::into).map(Cow::Owned), evm.deployed_bytecode.clone().map(Into::into).map(Cow::Owned), @@ -523,7 +523,7 @@ impl<'a> CompactContractRef<'a> { impl<'a> From<&'a Contract> for CompactContractRef<'a> { fn from(c: &'a Contract) -> Self { - let (bin, bin_runtime) = if let Some(ref evm) = c.evm { + let (bin, bin_runtime) = if let Some(evm) = &c.evm { ( evm.bytecode.as_ref().map(|c| &c.object), evm.deployed_bytecode diff --git a/crates/artifacts/solc/src/lib.rs b/crates/artifacts/solc/src/lib.rs index a14d64ca..a04da256 100644 --- a/crates/artifacts/solc/src/lib.rs +++ b/crates/artifacts/solc/src/lib.rs @@ -361,7 +361,7 @@ impl Settings { } } - if let Some(ref mut evm_version) = self.evm_version { + if let Some(evm_version) = self.evm_version { self.evm_version = evm_version.normalize_version_solc(version); } diff --git a/crates/compilers/src/compile/output/info.rs b/crates/compilers/src/compile/output/info.rs index ad7e1c1f..0088164d 100644 --- a/crates/compilers/src/compile/output/info.rs +++ b/crates/compilers/src/compile/output/info.rs @@ -44,11 +44,10 @@ impl ContractInfo { impl fmt::Display for ContractInfo { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if let Some(ref path) = self.path { - write!(f, "{path}:{}", self.name) - } else { - write!(f, "{}", self.name) + if let Some(path) = &self.path { + write!(f, "{path}:")?; } + f.write_str(&self.name) } } diff --git a/crates/compilers/src/report/compiler.rs b/crates/compilers/src/report/compiler.rs index 04afa17c..59307a9a 100644 --- a/crates/compilers/src/report/compiler.rs +++ b/crates/compilers/src/report/compiler.rs @@ -56,14 +56,14 @@ impl SolcCompilerIoReporter { /// Callback to write the input to disk if target is set pub fn log_compiler_input(&self, input: &SolcInput, version: &Version) { - if let Some(ref target) = self.target { + if let Some(target) = &self.target { target.write_input(input, version) } } /// Callback to write the input to disk if target is set pub fn log_compiler_output(&self, output: &CompilerOutput, version: &Version) { - if let Some(ref target) = self.target { + if let Some(target) = &self.target { target.write_output(output, version) } } diff --git a/crates/compilers/src/resolver/mod.rs b/crates/compilers/src/resolver/mod.rs index 4b256bf3..f515402a 100644 --- a/crates/compilers/src/resolver/mod.rs +++ b/crates/compilers/src/resolver/mod.rs @@ -1096,7 +1096,7 @@ impl fmt::Display for DisplayNode<'_, D> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let path = utils::source_name(&self.node.path, self.root); write!(f, "{}", path.display())?; - if let Some(ref v) = self.node.data.version_req() { + if let Some(v) = self.node.data.version_req() { write!(f, " {v}")?; } Ok(()) diff --git a/crates/compilers/src/resolver/parse.rs b/crates/compilers/src/resolver/parse.rs index 064dbfc2..c9b91469 100644 --- a/crates/compilers/src/resolver/parse.rs +++ b/crates/compilers/src/resolver/parse.rs @@ -34,7 +34,7 @@ impl SolData { &self, f: &mut W, ) -> std::result::Result<(), std::fmt::Error> { - if let Some(ref version) = self.version { + if let Some(version) = &self.version { write!(f, "({})", version.data)?; } Ok(())