Skip to content

Commit bb3b16c

Browse files
committed
chore: Enable rust-2024-compatibility lints
Accept the new rules for the `expr` fragment specifier in declarative macros, as it only pertains to internal macros. Accept the new scoping rules of `if-let`, since the new rules don't affect the one place it applies.
1 parent 7923b9d commit bb3b16c

File tree

10 files changed

+22
-11
lines changed

10 files changed

+22
-11
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ lto = "thin"
1818
[workspace.dependencies.tasm-object-derive]
1919
version = "0.48.0"
2020
path = "tasm-object-derive"
21+
22+
[workspace.lints.rust]
23+
edition-2024-expr-fragment-specifier = "allow" # accept the new `expr` fragment specifier rules
24+
if-let-rescope = "allow" # accept the new `if-let` scope
25+
rust-2024-compatibility = "warn"

tasm-lib/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ triton-vm = { version = "0.48.0", default-features = false }
4242
version = "1"
4343
default-features = false
4444
features = ["user-hooks"]
45+
46+
[lints]
47+
workspace = true

tasm-lib/src/arithmetic/u128/safe_add.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ mod tests {
9393
edge_case_points
9494
.iter()
9595
.cartesian_product(&edge_case_points)
96-
.filter(|(&l, &r)| l.checked_add(r).is_some())
96+
.filter(|&(&l, &r)| l.checked_add(r).is_some())
9797
.map(|(&l, &r)| (l, r))
9898
.collect()
9999
}

tasm-lib/src/arithmetic/u64/add.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ mod tests {
9898
corner_case_points
9999
.iter()
100100
.cartesian_product(&corner_case_points)
101-
.filter(|(&l, &r)| l.checked_add(r).is_some())
101+
.filter(|&(&l, &r)| l.checked_add(r).is_some())
102102
.map(|(&l, &r)| (l, r))
103103
.collect()
104104
}

tasm-lib/src/arithmetic/u64/sub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ mod tests {
128128
edge_case_values
129129
.iter()
130130
.cartesian_product(&edge_case_values)
131-
.filter(|(&subtrahend, &minuend)| minuend.checked_sub(subtrahend).is_some())
131+
.filter(|&(&subtrahend, &minuend)| minuend.checked_sub(subtrahend).is_some())
132132
.map(|(&subtrahend, &minuend)| (subtrahend, minuend))
133133
.collect()
134134
}

tasm-lib/src/list/higher_order/map.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,12 @@ impl<const NUM_INPUT_LISTS: usize> ChainMap<NUM_INPUT_LISTS> {
8282
/// [len]: BFieldCodec::static_length
8383
/// [bfe]: DataType::Bfe
8484
pub fn new(f: InnerFunction) -> Self {
85-
if let Some(input_len) = f.domain().static_length() {
85+
let domain = f.domain();
86+
if let Some(input_len) = domain.static_length() {
8687
// need instruction `place {input_type.stack_size()}`
8788
assert!(input_len < OpStackElement::COUNT);
8889
} else {
89-
let DataType::Tuple(tuple) = f.domain() else {
90+
let DataType::Tuple(tuple) = domain else {
9091
panic!("{INNER_FN_INCORRECT_INPUT_DYN_LEN}");
9192
};
9293
let [_, DataType::Bfe] = tuple[..] else {

tasm-lib/src/mmr/verify_mmr_successor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ mod tests {
581581

582582
for peak_idx in 0..old.peaks().len() {
583583
let mut wrong_old_peaks = old.peaks();
584-
let Digest(ref mut digest_to_disturb) = &mut wrong_old_peaks[peak_idx];
584+
let Digest(ref mut digest_to_disturb) = wrong_old_peaks[peak_idx];
585585
let digest_to_disturb_innards_idx = rng.random_range(0..Digest::LEN);
586586
digest_to_disturb[digest_to_disturb_innards_idx].increment();
587587

@@ -592,7 +592,7 @@ mod tests {
592592
for proof_path_idx in 0..proof.paths.len() {
593593
let mut wrong_proof = proof.clone();
594594
let proof_paths = &mut wrong_proof.paths;
595-
let Digest(ref mut digest_to_disturb) = &mut proof_paths[proof_path_idx];
595+
let Digest(ref mut digest_to_disturb) = proof_paths[proof_path_idx];
596596
let digest_to_disturb_innards_idx = rng.random_range(0..Digest::LEN);
597597
digest_to_disturb[digest_to_disturb_innards_idx].increment();
598598

tasm-lib/src/test_helpers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ pub(crate) fn verify_memory_equivalence(
115115

116116
let in_a_and_different_in_b = a_memory
117117
.iter()
118-
.filter(|(k, &v)| b_memory.get(k).map(|&b| b != v).unwrap_or(true));
118+
.filter(|&(k, v)| b_memory.get(k).map(|b| b != v).unwrap_or(true));
119119
let in_b_and_different_in_a = b_memory
120120
.iter()
121-
.filter(|(k, &v)| a_memory.get(k).map(|&b| b != v).unwrap_or(true));
121+
.filter(|&(k, v)| a_memory.get(k).map(|b| b != v).unwrap_or(true));
122122

123123
let in_a_and_different_in_b = format_hash_map_iterator(in_a_and_different_in_b);
124124
let in_b_and_different_in_a = format_hash_map_iterator(in_b_and_different_in_a);

tasm-lib/src/verifier/fri/verify_fri_authentication_paths.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,7 @@ mod tests {
384384
let mut initial_state = VerifyFriAuthenticationPaths.pseudorandom_initial_state(seed, None);
385385
let auth_paths = &mut initial_state.nondeterminism.digests;
386386
let digest_index = digest_index % auth_paths.len();
387-
let auth_path_element = &mut auth_paths[digest_index];
388-
let Digest(ref mut auth_path_element_innards) = auth_path_element;
387+
let Digest(ref mut auth_path_element_innards) = auth_paths[digest_index];
389388
auth_path_element_innards[perturbation_index] += bfe!(perturbation);
390389

391390
test_assertion_failure(

tasm-object-derive/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ proc-macro = true
2323

2424
[dev-dependencies]
2525
prettyplease = "0.2.29"
26+
27+
[lints]
28+
workspace = true

0 commit comments

Comments
 (0)