Skip to content

Commit

Permalink
feat: bump MSRV to 1.83 (#9473)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Dec 3, 2024
1 parent 8ef1302 commit 2f56133
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resolver = "2"
version = "0.2.0"
edition = "2021"
# Remember to update clippy.toml as well
rust-version = "1.80"
rust-version = "1.83"
authors = ["Foundry Contributors"]
license = "MIT OR Apache-2.0"
homepage = "https://github.com/foundry-rs/foundry"
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
msrv = "1.80"
msrv = "1.83"
# bytes::Bytes is included by default and alloy_primitives::Bytes is a wrapper around it,
# so it is safe to ignore it as well
ignore-interior-mutability = ["bytes::Bytes", "alloy_primitives::Bytes"]
Expand Down
2 changes: 1 addition & 1 deletion crates/cheatcodes/src/evm/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ fn mock_calls(
fn make_acc_non_empty(callee: &Address, ecx: InnerEcx) -> Result {
let acc = ecx.load_account(*callee)?;

let empty_bytecode = acc.info.code.as_ref().map_or(true, Bytecode::is_empty);
let empty_bytecode = acc.info.code.as_ref().is_none_or(Bytecode::is_empty);
if empty_bytecode {
let code = Bytecode::new_raw(Bytes::from_static(&[0u8]));
ecx.journaled_state.set_code(*callee, code);
Expand Down
9 changes: 4 additions & 5 deletions crates/cheatcodes/src/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -902,12 +902,11 @@ where {
*calldata == call.input[..calldata.len()] &&
// The value matches, if provided
expected
.value
.map_or(true, |value| Some(value) == call.transfer_value()) &&
.value.is_none_or(|value| Some(value) == call.transfer_value()) &&
// The gas matches, if provided
expected.gas.map_or(true, |gas| gas == call.gas_limit) &&
expected.gas.is_none_or(|gas| gas == call.gas_limit) &&
// The minimum gas matches, if provided
expected.min_gas.map_or(true, |min_gas| min_gas <= call.gas_limit)
expected.min_gas.is_none_or(|min_gas| min_gas <= call.gas_limit)
{
*actual_count += 1;
}
Expand All @@ -925,7 +924,7 @@ where {
.iter_mut()
.find(|(mock, _)| {
call.input.get(..mock.calldata.len()) == Some(&mock.calldata[..]) &&
mock.value.map_or(true, |value| Some(value) == call.transfer_value())
mock.value.is_none_or(|value| Some(value) == call.transfer_value())
})
.map(|(_, v)| v),
} {
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/evm/src/executors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl Executor {
.ok_or_else(|| BackendError::MissingAccount(DEFAULT_CREATE2_DEPLOYER))?;

// If the deployer is not currently deployed, deploy the default one.
if create2_deployer_account.code.map_or(true, |code| code.is_empty()) {
if create2_deployer_account.code.is_none_or(|code| code.is_empty()) {
let creator = DEFAULT_CREATE2_DEPLOYER_DEPLOYER;

// Probably 0, but just in case.
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/traces/src/debug/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl ArtifactData {
fn new(bytecode: ContractBytecodeSome, build_id: String, file_id: u32) -> Result<Self> {
let parse = |b: &Bytecode, name: &str| {
// Only parse source map if it's not empty.
let source_map = if b.source_map.as_ref().map_or(true, |s| s.is_empty()) {
let source_map = if b.source_map.as_ref().is_none_or(|s| s.is_empty()) {
Ok(None)
} else {
b.source_map().transpose().wrap_err_with(|| {
Expand Down
2 changes: 1 addition & 1 deletion crates/fmt/src/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl CommentWithMetadata {
return Self::new(
comment,
CommentPosition::Prefix,
last_line.map_or(true, str::is_empty),
last_line.is_none_or(str::is_empty),
indent_len,
)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/forge/bin/cmd/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ impl CoverageArgs {
let file_pattern = filter.args().coverage_pattern_inverse.as_ref();
let file_root = &filter.paths().root;
report.filter_out_ignored_sources(|path: &Path| {
file_pattern.map_or(true, |re| {
file_pattern.is_none_or(|re| {
!re.is_match(&path.strip_prefix(file_root).unwrap_or(path).to_string_lossy())
})
});
Expand Down
4 changes: 2 additions & 2 deletions crates/script/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ impl PreprocessedState {
if id.name != *name {
continue;
}
} else if contract.abi.as_ref().map_or(true, |abi| abi.is_empty()) ||
contract.bytecode.as_ref().map_or(true, |b| match &b.object {
} else if contract.abi.as_ref().is_none_or(|abi| abi.is_empty()) ||
contract.bytecode.as_ref().is_none_or(|b| match &b.object {
BytecodeObject::Bytecode(b) => b.is_empty(),
BytecodeObject::Unlinked(_) => false,
})
Expand Down
2 changes: 1 addition & 1 deletion crates/script/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl ScriptArgs {
.execution_result
.transactions
.as_ref()
.map_or(true, |txs| txs.is_empty())
.is_none_or(|txs| txs.is_empty())
{
return Ok(());
}
Expand Down
2 changes: 1 addition & 1 deletion crates/verify/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl VerificationProviderType {
pub fn client(&self, key: &Option<String>) -> Result<Box<dyn VerificationProvider>> {
match self {
Self::Etherscan => {
if key.as_ref().map_or(true, |key| key.is_empty()) {
if key.as_ref().is_none_or(|key| key.is_empty()) {
eyre::bail!("ETHERSCAN_API_KEY must be set")
}
Ok(Box::<EtherscanVerificationProvider>::default())
Expand Down

0 comments on commit 2f56133

Please sign in to comment.