Skip to content

Commit 68989f0

Browse files
committed
solana: deny truncation in Cargo.toml instead of GitHub yml
1 parent 32481ba commit 68989f0

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

.github/workflows/solana.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
run: cargo check --workspace --tests --manifest-path solana/Cargo.toml
7171

7272
- name: Run `cargo clippy`
73-
run: cargo clippy --workspace --tests --manifest-path solana/Cargo.toml -- -Dclippy::cast_possible_truncation
73+
run: cargo clippy --workspace --tests --manifest-path solana/Cargo.toml
7474

7575
- name: Cache solana tools
7676
id: cache-solana

solana/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ resolver = "2"
99
[workspace.lints.clippy]
1010
# The following rules should be enabled but conflict with other open PRs.
1111
# TODO enable the commented rules below
12-
# cast_possible_truncation = "deny"
12+
cast_possible_truncation = "deny"
1313
# cast_lossless= "deny"
1414
# as_conversions = "deny"
1515
# arithmetic_side_effects = "deny"

solana/programs/example-native-token-transfers/src/bitmap.rs

-9
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ impl Bitmap {
3131
BM::<128>::from_value(self.map).get(index as usize)
3232
}
3333

34-
#[allow(clippy::cast_possible_truncation)]
3534
pub fn count_enabled_votes(&self, enabled: Bitmap) -> u8 {
3635
let bm = BM::<128>::from_value(self.map) & BM::<128>::from_value(enabled.map);
37-
// Conversion from usize to u8 is safe here. The Bitmap uses u128, so it's maximum length
38-
// (number of true bits) is 128.
3936
bm.len() as u8
4037
}
4138
}
@@ -67,10 +64,4 @@ mod tests {
6764
enabled.set(18, false);
6865
assert_eq!(bm.count_enabled_votes(enabled), 1);
6966
}
70-
71-
#[test]
72-
fn test_bitmap_len() {
73-
let max_bitmap = Bitmap::from_value(u128::MAX);
74-
assert_eq!(128, max_bitmap.count_enabled_votes(max_bitmap));
75-
}
7667
}

0 commit comments

Comments
 (0)