Skip to content

chore: bump to rust edition 2024 #10802

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

zerosnacks
Copy link
Member

@zerosnacks zerosnacks commented Jun 18, 2025

Motivation

Closes: #10734

Solution

Initial commit was done as a trial run with Claude, worked quite well!

Some of the added .clone() is concerning, will look for alternative solution to deal with ownership. We are mostly dealing with Arc's and the other fields are likely light to clone.

Expecting this PR to fail its lint check, doing that in a follow-up here: #10803 as the diff is very large in terms of number of files touched

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@@ -82,7 +82,6 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2024-02-03
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found out we were pinning to this specific nightly, this seems unintended / resolved

@@ -46,7 +46,7 @@ pub struct HexIdProvider {

impl HexIdProvider {
/// Generates a random hex encoded Id
pub fn gen(&self) -> String {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gen is now a reserved keyword, found generate better than r#gen

@@ -20,7 +20,7 @@ impl Cheatcode for setEnvCall {
} else if value.contains('\0') {
Err(fmt_err!("environment variable value can't contain NUL character `\\0`"))
} else {
env::set_var(key, value);
unsafe { env::set_var(key, value); }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsafe is now required for things that touch the environment

Comment on lines +77 to +78
fuzz_state.clone(),
fuzz_fixtures.clone(),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to lifetime / ownership issues clone is not required here - not ideal!

let settings = cache.profiles.get(&profile).expect("must be present");

settings
cache.profiles.get(&profile).expect("must be present")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clippy lint rule now enforces returning the result of a let binding from a block preferring direct returns where possible

@@ -514,7 +514,7 @@ impl<'a> InvariantExecutor<'a> {
invariant_contract: &InvariantContract<'_>,
fuzz_fixtures: &FuzzFixtures,
deployed_libs: &[Address],
) -> Result<(InvariantTest, impl Strategy<Value = BasicTxDetails>)> {
) -> Result<(InvariantTest, impl Strategy<Value = BasicTxDetails> + use<>)> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zerosnacks zerosnacks marked this pull request as ready for review June 19, 2025 12:44
@zerosnacks zerosnacks moved this to Ready For Review in Foundry Jun 19, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

chore: update Rust edition to 2024
1 participant