Skip to content

Commit

Permalink
chore: bump MSRV to 1.83 (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Dec 2, 2024
1 parent 9589a49 commit a1ce2b4
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 29 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
rust: ["stable", "1.70"]
rust: ["stable", "1.83"]
flags: ["", "--all-features"]
exclude:
# Skip because some features have higher MSRV.
- rust: "1.70" # MSRV
- rust: "1.83" # MSRV
flags: "--all-features"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Install test binaries
shell: bash
run: ./.github/scripts/install_test_binaries.sh
Expand All @@ -38,11 +40,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: build
if: matrix.rust == '1.70' # MSRV
run: cargo build --workspace ${{ matrix.flags }}
- name: test
if: matrix.rust != '1.70' # MSRV
shell: bash
run: cargo nextest run ${{ matrix.flags }} --retries 2

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resolver = "2"
[workspace.package]
authors = ["Foundry Maintainers"]
version = "0.12.3"
rust-version = "1.70"
rust-version = "1.83"
readme = "README.md"
license = "MIT OR Apache-2.0"
repository = "https://github.com/foundry-rs/compilers"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ When updating this, also update:

Foundry Compilers will keep a rolling MSRV (minimum supported rust version) policy of **at
least** 6 months. When increasing the MSRV, the new Rust version must have been
released at least six months ago. The current MSRV is 1.70.0.
released at least six months ago. The current MSRV is 1.83.0.

Note that the MSRV is not increased automatically, and only as part of a minor
release.
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv = "1.70"
msrv = "1.83"
8 changes: 5 additions & 3 deletions crates/artifacts/solc/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ impl fmt::Display for Error {
// unless it also contains a source location, in which case the entire error message is an
// old style error message, like:
// path/to/file:line:column: ErrorType: message
if lines.clone().next().map_or(false, |l| {
l.contains(short_msg) && l.bytes().filter(|b| *b == b':').count() < 3
}) {
if lines
.clone()
.next()
.is_some_and(|l| l.contains(short_msg) && l.bytes().filter(|b| *b == b':').count() < 3)
{
let _ = lines.next();
}

Expand Down
4 changes: 2 additions & 2 deletions crates/artifacts/solc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ impl SolcInput {
let mut yul_sources = Sources::new();

for (file, source) in sources {
if file.extension().map_or(false, |e| e == "yul") {
if file.extension().is_some_and(|e| e == "yul") {
yul_sources.insert(file, source);
} else if file.extension().map_or(false, |e| e == "sol") {
} else if file.extension().is_some_and(|e| e == "sol") {
solidity_sources.insert(file, source);
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/artifacts/solc/src/output_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ impl OutputSelection {
/// TODO: correctly process wildcard keys to reduce false negatives
pub fn is_subset_of(&self, other: &Self) -> bool {
self.0.iter().all(|(file, selection)| {
other.0.get(file).map_or(false, |other_selection| {
other.0.get(file).is_some_and(|other_selection| {
selection.iter().all(|(contract, outputs)| {
other_selection.get(contract).map_or(false, |other_outputs| {
other_selection.get(contract).is_some_and(|other_outputs| {
outputs.iter().all(|output| other_outputs.contains(output))
})
})
Expand Down
2 changes: 1 addition & 1 deletion crates/artifacts/vyper/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl VyperInput {
let mut interfaces = Sources::new();

for (path, content) in sources {
if path.extension().map_or(false, |ext| ext == VYPER_INTERFACE_EXTENSION) {
if path.extension().is_some_and(|ext| ext == VYPER_INTERFACE_EXTENSION) {
// Interface .vyi files should be removed from the output selection.
settings.output_selection.0.remove(path.to_string_lossy().as_ref());
interfaces.insert(path, content);
Expand Down
6 changes: 2 additions & 4 deletions crates/compilers/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ impl GroupedSources {

/// Returns true if the file was included with the given version.
pub fn contains(&self, file: &Path, version: &Version) -> bool {
self.inner.get(file).map_or(false, |versions| versions.contains(version))
self.inner.get(file).is_some_and(|versions| versions.contains(version))
}
}

Expand Down Expand Up @@ -783,9 +783,7 @@ impl<T: ArtifactOutput, C: Compiler> ArtifactsCacheInner<'_, T, C> {

let mut dirty_profiles = HashSet::new();
for (profile, settings) in &self.cache.profiles {
if !existing_profiles
.get(profile.as_str())
.map_or(false, |p| p.can_use_cached(settings))
if !existing_profiles.get(profile.as_str()).is_some_and(|p| p.can_use_cached(settings))
{
trace!("dirty profile: {}", profile);
dirty_profiles.insert(profile.clone());
Expand Down
2 changes: 1 addition & 1 deletion crates/compilers/src/compile/output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ impl<C: Compiler> AggregatedCompilerOutput<C> {

self.contracts.contracts_with_files().filter(|(path, _, _)| *path == contract_path).any(
|(_, _, contract)| {
contract.abi.as_ref().map_or(false, |abi| abi.functions.contains_key("IS_TEST"))
contract.abi.as_ref().is_some_and(|abi| abi.functions.contains_key("IS_TEST"))
},
)
}
Expand Down
6 changes: 3 additions & 3 deletions crates/compilers/src/compilers/solc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ impl<V: Ord + Copy> Restriction<V> {
///
/// If given None, only returns true if no restrictions are set
pub fn satisfies(&self, value: Option<V>) -> bool {
self.min.map_or(true, |min| value.map_or(false, |v| v >= min))
&& self.max.map_or(true, |max| value.map_or(false, |v| v <= max))
self.min.is_none_or(|min| value.is_some_and(|v| v >= min))
&& self.max.is_none_or(|max| value.is_some_and(|v| v <= max))
}

/// Combines two restrictions into a new one
Expand Down Expand Up @@ -346,7 +346,7 @@ impl CompilerSettings for SolcSettings {
// Ensure that we either don't have min optimizer runs set or that the optimizer is enabled
satisfies &= optimizer_runs
.min
.map_or(true, |min| min == 0 || self.optimizer.enabled.unwrap_or_default());
.is_none_or(|min| min == 0 || self.optimizer.enabled.unwrap_or_default());

satisfies
}
Expand Down
2 changes: 1 addition & 1 deletion crates/compilers/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl<'a> SparseOutputFilter<'a> {
.collect();

// Remove clean sources, those will be read from cache.
full_compilation.retain(|file| sources.0.get(file).map_or(false, |s| s.is_dirty()));
full_compilation.retain(|file| sources.0.get(file).is_some_and(|s| s.is_dirty()));

settings.update_output_selection(|selection| {
trace!(
Expand Down
2 changes: 1 addition & 1 deletion crates/compilers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ impl<T: ArtifactOutput, C: Compiler> Project<C, T> {
{
let mut contracts = self.collect_contract_names()?;

if contracts.get(target_name).map_or(true, |paths| paths.is_empty()) {
if contracts.get(target_name).is_none_or(|paths| paths.is_empty()) {
return Err(SolcError::msg(format!("No contract found with the name `{target_name}`")));
}
let mut paths = contracts.remove(target_name).unwrap();
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 @@ -45,7 +45,7 @@ impl SolData {
/// This will attempt to parse the solidity AST and extract the imports and version pragma. If
/// parsing fails, we'll fall back to extract that info via regex
pub fn parse(content: &str, file: &Path) -> Self {
let is_yul = file.extension().map_or(false, |ext| ext == "yul");
let is_yul = file.extension().is_some_and(|ext| ext == "yul");
let mut version = None;
let mut experimental = None;
let mut imports = Vec::<Spanned<SolImport>>::new();
Expand Down

0 comments on commit a1ce2b4

Please sign in to comment.