Skip to content

Commit 4273f12

Browse files
committed
fix clippy
1 parent 9713ed8 commit 4273f12

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

core/src/avm_rng.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,12 @@ const C2: i32 = 789221;
1313
const C3: i32 = 15731;
1414
const K_RANDOM_PURE_MAX: i32 = 0x7FFFFFFF;
1515

16-
#[derive(Debug, Clone, Copy)]
16+
#[derive(Debug, Clone, Copy, Default)]
1717
pub struct AvmRng {
1818
u_value: u32,
1919
u_xor_mask: u32,
2020
}
2121

22-
impl Default for AvmRng {
23-
fn default() -> Self {
24-
Self {
25-
u_value: 0, // 0 means uninitialized
26-
u_xor_mask: 0,
27-
}
28-
}
29-
}
30-
3122
impl AvmRng {
3223
pub fn init_with_seed(&mut self, seed: u32) {
3324
self.u_value = seed;
@@ -43,15 +34,15 @@ impl AvmRng {
4334
self.u_value as i32
4435
}
4536

46-
fn random_pure_hasher(&self, mut i_seed: i32) -> i32 {
37+
fn random_pure_hasher(self, mut i_seed: i32) -> i32 {
4738
i_seed = ((i_seed << 13) ^ i_seed).wrapping_sub(i_seed >> 21);
4839

4940
let mut i_result = i_seed.wrapping_mul(i_seed);
5041
i_result = i_result.wrapping_mul(C3);
5142
i_result = i_result.wrapping_add(C2);
5243
i_result = i_result.wrapping_mul(i_seed);
5344
i_result = i_result.wrapping_add(C1);
54-
i_result = i_result & K_RANDOM_PURE_MAX;
45+
i_result &= K_RANDOM_PURE_MAX;
5546

5647
i_result = i_result.wrapping_add(i_seed);
5748

0 commit comments

Comments
 (0)