Skip to content

Commit

Permalink
chore: remove outdated ref patterns (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Nov 18, 2024
1 parent e9668e1 commit 2db27d7
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/artifacts/solc/src/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ impl BytecodeObject {
///
/// See also: <https://docs.soliditylang.org/en/develop/using-the-compiler.html#library-linking>
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);
Expand Down
4 changes: 2 additions & 2 deletions crates/artifacts/solc/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/artifacts/solc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
7 changes: 3 additions & 4 deletions crates/compilers/src/compile/output/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/compilers/src/report/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/compilers/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ impl<D: ParsedSource> 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(())
Expand Down
2 changes: 1 addition & 1 deletion crates/compilers/src/resolver/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down

0 comments on commit 2db27d7

Please sign in to comment.