Skip to content

Commit 2db27d7

Browse files
authored
chore: remove outdated ref patterns (#218)
1 parent e9668e1 commit 2db27d7

File tree

7 files changed

+11
-12
lines changed

7 files changed

+11
-12
lines changed

crates/artifacts/solc/src/bytecode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl BytecodeObject {
303303
///
304304
/// See also: <https://docs.soliditylang.org/en/develop/using-the-compiler.html#library-linking>
305305
pub fn link_fully_qualified(&mut self, name: &str, addr: Address) -> &mut Self {
306-
if let Self::Unlinked(ref mut unlinked) = self {
306+
if let Self::Unlinked(unlinked) = self {
307307
let place_holder = utils::library_hash_placeholder(name);
308308
// the address as hex without prefix
309309
let hex_addr = hex::encode(addr);

crates/artifacts/solc/src/contract.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub struct Contract {
4848

4949
impl<'a> From<&'a Contract> for CompactContractBytecodeCow<'a> {
5050
fn from(artifact: &'a Contract) -> Self {
51-
let (bytecode, deployed_bytecode) = if let Some(ref evm) = artifact.evm {
51+
let (bytecode, deployed_bytecode) = if let Some(evm) = &artifact.evm {
5252
(
5353
evm.bytecode.clone().map(Into::into).map(Cow::Owned),
5454
evm.deployed_bytecode.clone().map(Into::into).map(Cow::Owned),
@@ -523,7 +523,7 @@ impl<'a> CompactContractRef<'a> {
523523

524524
impl<'a> From<&'a Contract> for CompactContractRef<'a> {
525525
fn from(c: &'a Contract) -> Self {
526-
let (bin, bin_runtime) = if let Some(ref evm) = c.evm {
526+
let (bin, bin_runtime) = if let Some(evm) = &c.evm {
527527
(
528528
evm.bytecode.as_ref().map(|c| &c.object),
529529
evm.deployed_bytecode

crates/artifacts/solc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ impl Settings {
361361
}
362362
}
363363

364-
if let Some(ref mut evm_version) = self.evm_version {
364+
if let Some(evm_version) = self.evm_version {
365365
self.evm_version = evm_version.normalize_version_solc(version);
366366
}
367367

crates/compilers/src/compile/output/info.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@ impl ContractInfo {
4444

4545
impl fmt::Display for ContractInfo {
4646
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
47-
if let Some(ref path) = self.path {
48-
write!(f, "{path}:{}", self.name)
49-
} else {
50-
write!(f, "{}", self.name)
47+
if let Some(path) = &self.path {
48+
write!(f, "{path}:")?;
5149
}
50+
f.write_str(&self.name)
5251
}
5352
}
5453

crates/compilers/src/report/compiler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ impl SolcCompilerIoReporter {
5656

5757
/// Callback to write the input to disk if target is set
5858
pub fn log_compiler_input(&self, input: &SolcInput, version: &Version) {
59-
if let Some(ref target) = self.target {
59+
if let Some(target) = &self.target {
6060
target.write_input(input, version)
6161
}
6262
}
6363

6464
/// Callback to write the input to disk if target is set
6565
pub fn log_compiler_output(&self, output: &CompilerOutput, version: &Version) {
66-
if let Some(ref target) = self.target {
66+
if let Some(target) = &self.target {
6767
target.write_output(output, version)
6868
}
6969
}

crates/compilers/src/resolver/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ impl<D: ParsedSource> fmt::Display for DisplayNode<'_, D> {
10961096
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
10971097
let path = utils::source_name(&self.node.path, self.root);
10981098
write!(f, "{}", path.display())?;
1099-
if let Some(ref v) = self.node.data.version_req() {
1099+
if let Some(v) = self.node.data.version_req() {
11001100
write!(f, " {v}")?;
11011101
}
11021102
Ok(())

crates/compilers/src/resolver/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl SolData {
3434
&self,
3535
f: &mut W,
3636
) -> std::result::Result<(), std::fmt::Error> {
37-
if let Some(ref version) = self.version {
37+
if let Some(version) = &self.version {
3838
write!(f, "({})", version.data)?;
3939
}
4040
Ok(())

0 commit comments

Comments
 (0)