@@ -122,7 +122,6 @@ pub(crate) mod tests {
122
122
123
123
use std:: marker:: PhantomData ;
124
124
use std:: mem:: size_of_val;
125
- use std:: result:: Result ;
126
125
use std:: sync:: atomic:: Ordering ;
127
126
128
127
use crate :: { Bytes , VolatileMemory } ;
@@ -165,12 +164,6 @@ pub(crate) mod tests {
165
164
assert ! ( range_is_dirty( & s, 0 , dirty_len) ) ;
166
165
}
167
166
168
- #[ derive( Debug ) ]
169
- pub enum TestAccessError {
170
- RangeCleanCheck ,
171
- RangeDirtyCheck ,
172
- }
173
-
174
167
// A helper object that implements auxiliary operations for testing `Bytes` implementations
175
168
// in the context of dirty bitmap tracking.
176
169
struct BytesHelper < F , G , M > {
@@ -209,21 +202,15 @@ pub(crate) mod tests {
209
202
dirty_offset : usize ,
210
203
dirty_len : usize ,
211
204
op : Op ,
212
- ) -> Result < ( ) , TestAccessError >
205
+ )
213
206
where
214
207
Op : Fn ( & M , A ) ,
215
208
{
216
- if !self . check_range ( bytes, dirty_offset, dirty_len, true ) {
217
- return Err ( TestAccessError :: RangeCleanCheck ) ;
218
- }
209
+ assert ! ( self . check_range( bytes, dirty_offset, dirty_len, true ) ) ;
219
210
220
211
op ( bytes, self . address ( dirty_offset) ) ;
221
212
222
- if !self . check_range ( bytes, dirty_offset, dirty_len, false ) {
223
- return Err ( TestAccessError :: RangeDirtyCheck ) ;
224
- }
225
-
226
- Ok ( ( ) )
213
+ assert ! ( self . check_range( bytes, dirty_offset, dirty_len, false ) ) ;
227
214
}
228
215
}
229
216
@@ -256,29 +243,25 @@ pub(crate) mod tests {
256
243
// Test `write`.
257
244
h. test_access ( bytes, dirty_offset, BUF_SIZE , |m, addr| {
258
245
assert_eq ! ( m. write( buf. as_slice( ) , addr) . unwrap( ) , BUF_SIZE )
259
- } )
260
- . unwrap ( ) ;
246
+ } ) ;
261
247
dirty_offset += step;
262
248
263
249
// Test `write_slice`.
264
250
h. test_access ( bytes, dirty_offset, BUF_SIZE , |m, addr| {
265
251
m. write_slice ( buf. as_slice ( ) , addr) . unwrap ( )
266
- } )
267
- . unwrap ( ) ;
252
+ } ) ;
268
253
dirty_offset += step;
269
254
270
255
// Test `write_obj`.
271
256
h. test_access ( bytes, dirty_offset, size_of_val ( & val) , |m, addr| {
272
257
m. write_obj ( val, addr) . unwrap ( )
273
- } )
274
- . unwrap ( ) ;
258
+ } ) ;
275
259
dirty_offset += step;
276
260
277
261
// Test `store`.
278
262
h. test_access ( bytes, dirty_offset, size_of_val ( & val) , |m, addr| {
279
263
m. store ( val, addr, Ordering :: Relaxed ) . unwrap ( )
280
- } )
281
- . unwrap ( ) ;
264
+ } ) ;
282
265
}
283
266
284
267
// This function and the next are currently conditionally compiled because we only use
0 commit comments