Skip to content

Commit 4900c56

Browse files
committed
fix linting
1 parent 0e3c1b7 commit 4900c56

File tree

6 files changed

+13
-23
lines changed

6 files changed

+13
-23
lines changed

crates/anvil/src/eth/backend/mem/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -964,8 +964,8 @@ impl Backend {
964964
// Defaults to block number for compatibility with existing state files.
965965
let fork_num_and_hash = self.get_fork().map(|f| (f.block_number(), f.block_hash()));
966966

967+
let best_number = state.best_block_number.unwrap_or(block.number.to::<U64>());
967968
if let Some((number, hash)) = fork_num_and_hash {
968-
let best_number = state.best_block_number.unwrap_or(block.number.to::<U64>());
969969
trace!(target: "backend", state_block_number=?best_number, fork_block_number=?number);
970970
// If the state.block_number is greater than the fork block number, set best number
971971
// to the state block number.
@@ -988,7 +988,6 @@ impl Backend {
988988
self.blockchain.storage.write().best_hash = hash;
989989
}
990990
} else {
991-
let best_number = state.best_block_number.unwrap_or(block.number.to::<U64>());
992991
self.blockchain.storage.write().best_number = best_number;
993992

994993
// Set the current best block hash;

crates/anvil/tests/it/txpool.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ async fn geth_txpool() {
2626
let tx = WithOtherFields::new(tx);
2727

2828
// send a few transactions
29-
let mut txs = Vec::new();
3029
for _ in 0..10 {
31-
let tx_hash = provider.send_transaction(tx.clone()).await.unwrap();
32-
txs.push(tx_hash);
30+
let _ = provider.send_transaction(tx.clone()).await.unwrap();
3331
}
3432

3533
// we gave a 20s block time, should be plenty for us to get the txpool's content

crates/evm/fuzz/src/strategies/param.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pub fn fuzz_param_from_state(
136136
.prop_map(move |value| {
137137
let mut fuzzed_addr = Address::from_word(value);
138138
if !deployed_libs.contains(&fuzzed_addr) {
139-
DynSolValue::Address(fuzzed_addr)
139+
// No need to do anything
140140
} else {
141141
let mut rng = StdRng::seed_from_u64(0x1337); // use deterministic rng
142142

@@ -151,9 +151,8 @@ pub fn fuzz_param_from_state(
151151
break;
152152
}
153153
}
154-
155-
DynSolValue::Address(fuzzed_addr)
156154
}
155+
DynSolValue::Address(fuzzed_addr)
157156
})
158157
.boxed()
159158
}

crates/fmt/src/formatter.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -2093,15 +2093,11 @@ impl<W: Write> Visitor for Formatter<'_, W> {
20932093
let (ident, string) = (ident.safe_unwrap(), string.safe_unwrap());
20942094
return_source_if_disabled!(self, loc, ';');
20952095

2096-
let pragma_descriptor = if ident.name == "solidity" {
2097-
// There are some issues with parsing Solidity's versions with crates like `semver`:
2098-
// 1. Ranges like `>=0.4.21<0.6.0` or `>=0.4.21 <0.6.0` are not parseable at all.
2099-
// 2. Versions like `0.8.10` got transformed into `^0.8.10` which is not the same.
2100-
// TODO: semver-solidity crate :D
2101-
&string.string
2102-
} else {
2103-
&string.string
2104-
};
2096+
// There are some issues with parsing Solidity's versions with crates like `semver`:
2097+
// 1. Ranges like `>=0.4.21<0.6.0` or `>=0.4.21 <0.6.0` are not parseable at all.
2098+
// 2. Versions like `0.8.10` got transformed into `^0.8.10` which is not the same.
2099+
// TODO: semver-solidity crate :D
2100+
let pragma_descriptor = &string.string;
21052101

21062102
write_chunk!(self, string.loc.end(), "pragma {} {};", &ident.name, pragma_descriptor)?;
21072103

crates/forge/src/cmd/clone.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -556,10 +556,8 @@ fn dump_sources(meta: &Metadata, root: &PathBuf, no_reorg: bool) -> Result<Vec<R
556556
PathBuf::from(&r.path)
557557
};
558558
r.path = new_path.to_string_lossy().to_string();
559-
remappings.push(r);
560-
} else {
561-
remappings.push(r);
562559
}
560+
remappings.push(r);
563561
}
564562

565563
Ok(remappings.into_iter().map(|r| r.into_relative(root)).collect())

crates/test-utils/src/util.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub fn initialize(target: &Path) {
237237

238238
// Initialize the global template if necessary.
239239
let mut lock = crate::fd_lock::new_lock(TEMPLATE_LOCK.as_path());
240-
let mut _read = Some(lock.read().unwrap());
240+
let mut _read = lock.read().unwrap();
241241
if fs::read(&*TEMPLATE_LOCK).unwrap() != b"1" {
242242
// We are the first to acquire the lock:
243243
// - initialize a new empty temp project;
@@ -248,7 +248,7 @@ pub fn initialize(target: &Path) {
248248
// but `TempProject` does not currently allow this: https://github.com/foundry-rs/compilers/issues/22
249249

250250
// Release the read lock and acquire a write lock, initializing the lock file.
251-
_read = None;
251+
drop(_read);
252252

253253
let mut write = lock.write().unwrap();
254254

@@ -291,7 +291,7 @@ pub fn initialize(target: &Path) {
291291

292292
// Release the write lock and acquire a new read lock.
293293
drop(write);
294-
_read = Some(lock.read().unwrap());
294+
_read = lock.read().unwrap();
295295
}
296296

297297
println!("- copying template dir from {}", tpath.display());

0 commit comments

Comments
 (0)