Skip to content

Commit 179dd37

Browse files
committed
Address nits
1 parent 028e2de commit 179dd37

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

crates/evm/fuzz/src/strategies/mutators.rs

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -157,31 +157,39 @@ impl AbiMutator for I256 {
157157

158158
impl AbiMutator for Address {
159159
#[instrument(name = "Address::flip_random_bit", skip(_size, test_runner), ret)]
160-
fn flip_random_bit(self, _size: usize, test_runner: &mut TestRunner) -> Option<Self> {
161-
let mut bytes: [u8; 20] = self.0.into();
162-
flip_random_bit_in_slice(&mut bytes, test_runner)?;
163-
Some(Self::from(bytes))
160+
fn flip_random_bit(mut self, _size: usize, test_runner: &mut TestRunner) -> Option<Self> {
161+
flip_random_bit_in_slice(self.as_mut_slice(), test_runner)?;
162+
Some(self)
164163
}
165164

166165
#[instrument(name = "Address::mutate_interesting_byte", skip(_size, test_runner), ret)]
167-
fn mutate_interesting_byte(self, _size: usize, test_runner: &mut TestRunner) -> Option<Self> {
168-
let mut bytes: [u8; 20] = self.0.into();
169-
mutate_interesting_byte_slice(&mut bytes, test_runner)?;
170-
Some(Self::from(bytes))
166+
fn mutate_interesting_byte(
167+
mut self,
168+
_size: usize,
169+
test_runner: &mut TestRunner,
170+
) -> Option<Self> {
171+
mutate_interesting_byte_slice(self.as_mut_slice(), test_runner)?;
172+
Some(self)
171173
}
172174

173175
#[instrument(name = "Address::mutate_interesting_word", skip(_size, test_runner), ret)]
174-
fn mutate_interesting_word(self, _size: usize, test_runner: &mut TestRunner) -> Option<Self> {
175-
let mut bytes: [u8; 20] = self.0.into();
176-
mutate_interesting_word_slice(&mut bytes, test_runner)?;
177-
Some(Self::from(bytes))
176+
fn mutate_interesting_word(
177+
mut self,
178+
_size: usize,
179+
test_runner: &mut TestRunner,
180+
) -> Option<Self> {
181+
mutate_interesting_word_slice(self.as_mut_slice(), test_runner)?;
182+
Some(self)
178183
}
179184

180185
#[instrument(name = "Address::mutate_interesting_dword", skip(_size, test_runner), ret)]
181-
fn mutate_interesting_dword(self, _size: usize, test_runner: &mut TestRunner) -> Option<Self> {
182-
let mut bytes: [u8; 20] = self.0.into();
183-
mutate_interesting_dword_slice(&mut bytes, test_runner)?;
184-
Some(Self::from(bytes))
186+
fn mutate_interesting_dword(
187+
mut self,
188+
_size: usize,
189+
test_runner: &mut TestRunner,
190+
) -> Option<Self> {
191+
mutate_interesting_dword_slice(self.as_mut_slice(), test_runner)?;
192+
Some(self)
185193
}
186194
}
187195

0 commit comments

Comments
 (0)