22
22
23
23
//! A typesafe bitmask flag generator.
24
24
25
- #[ cfg( test) ] #[ macro_use] extern crate std;
25
+ #[ cfg( test) ]
26
+ #[ macro_use]
27
+ extern crate std;
26
28
27
29
/// The `bitflags!` macro generates a `struct` that holds a set of C-style
28
30
/// bitmask flags. It is useful for creating typesafe wrappers for C APIs.
@@ -321,7 +323,7 @@ mod tests {
321
323
}
322
324
323
325
#[ test]
324
- fn test_bits ( ) {
326
+ fn test_bits ( ) {
325
327
assert_eq ! ( Flags :: empty( ) . bits( ) , 0b00000000 ) ;
326
328
assert_eq ! ( Flags :: FlagA . bits( ) , 0b00000001 ) ;
327
329
assert_eq ! ( Flags :: FlagABC . bits( ) , 0b00000111 ) ;
@@ -354,7 +356,7 @@ mod tests {
354
356
}
355
357
356
358
#[ test]
357
- fn test_is_empty ( ) {
359
+ fn test_is_empty ( ) {
358
360
assert ! ( Flags :: empty( ) . is_empty( ) ) ;
359
361
assert ! ( !Flags :: FlagA . is_empty( ) ) ;
360
362
assert ! ( !Flags :: FlagABC . is_empty( ) ) ;
@@ -413,7 +415,7 @@ mod tests {
413
415
}
414
416
415
417
#[ test]
416
- fn test_insert ( ) {
418
+ fn test_insert ( ) {
417
419
let mut e1 = Flags :: FlagA ;
418
420
let e2 = Flags :: FlagA | Flags :: FlagB ;
419
421
e1. insert ( e2) ;
@@ -425,7 +427,7 @@ mod tests {
425
427
}
426
428
427
429
#[ test]
428
- fn test_remove ( ) {
430
+ fn test_remove ( ) {
429
431
let mut e1 = Flags :: FlagA | Flags :: FlagB ;
430
432
let e2 = Flags :: FlagA | Flags :: FlagC ;
431
433
e1. remove ( e2) ;
@@ -484,12 +486,12 @@ mod tests {
484
486
485
487
#[ test]
486
488
fn test_hash ( ) {
487
- let mut x = Flags :: empty ( ) ;
488
- let mut y = Flags :: empty ( ) ;
489
- assert ! ( hash( & x) == hash( & y) ) ;
490
- x = Flags :: all ( ) ;
491
- y = Flags :: FlagABC ;
492
- assert ! ( hash( & x) == hash( & y) ) ;
489
+ let mut x = Flags :: empty ( ) ;
490
+ let mut y = Flags :: empty ( ) ;
491
+ assert ! ( hash( & x) == hash( & y) ) ;
492
+ x = Flags :: all ( ) ;
493
+ y = Flags :: FlagABC ;
494
+ assert ! ( hash( & x) == hash( & y) ) ;
493
495
}
494
496
495
497
fn hash < T : Hash > ( t : & T ) -> u64 {
0 commit comments