2424/// ```{.rust}
2525/// bitflags! {
2626/// flags Flags: u32 {
27- /// const FLAG_A = 0x00000001 ,
28- /// const FLAG_B = 0x00000010 ,
29- /// const FLAG_C = 0x00000100 ,
27+ /// const FLAG_A = 0b00000001 ,
28+ /// const FLAG_B = 0b00000010 ,
29+ /// const FLAG_C = 0b00000100 ,
3030/// const FLAG_ABC = FLAG_A.bits
3131/// | FLAG_B.bits
3232/// | FLAG_C.bits,
5050///
5151/// bitflags! {
5252/// flags Flags: u32 {
53- /// const FLAG_A = 0x00000001 ,
54- /// const FLAG_B = 0x00000010 ,
53+ /// const FLAG_A = 0b00000001 ,
54+ /// const FLAG_B = 0b00000010 ,
5555/// }
5656/// }
5757///
@@ -326,10 +326,10 @@ mod tests {
326326 #[ doc = "> " ]
327327 #[ doc = "> - Richard Feynman" ]
328328 flags Flags : u32 {
329- const FlagA = 0x00000001 ,
329+ const FlagA = 0b00000001 ,
330330 #[ doc = "<pcwalton> macros are way better at generating code than trans is" ]
331- const FlagB = 0x00000010 ,
332- const FlagC = 0x00000100 ,
331+ const FlagB = 0b00000010 ,
332+ const FlagC = 0b00000100 ,
333333 #[ doc = "* cmr bed" ]
334334 #[ doc = "* strcat table" ]
335335 #[ doc = "<strcat> wait what?" ]
@@ -347,33 +347,33 @@ mod tests {
347347
348348 #[ test]
349349 fn test_bits ( ) {
350- assert_eq ! ( Flags :: empty( ) . bits( ) , 0x00000000 ) ;
351- assert_eq ! ( FlagA . bits( ) , 0x00000001 ) ;
352- assert_eq ! ( FlagABC . bits( ) , 0x00000111 ) ;
350+ assert_eq ! ( Flags :: empty( ) . bits( ) , 0b00000000 ) ;
351+ assert_eq ! ( FlagA . bits( ) , 0b00000001 ) ;
352+ assert_eq ! ( FlagABC . bits( ) , 0b00000111 ) ;
353353
354- assert_eq ! ( AnotherSetOfFlags :: empty( ) . bits( ) , 0x00 ) ;
354+ assert_eq ! ( AnotherSetOfFlags :: empty( ) . bits( ) , 0b00 ) ;
355355 assert_eq ! ( AnotherFlag . bits( ) , !0_i8 ) ;
356356 }
357357
358358 #[ test]
359359 fn test_from_bits ( ) {
360360 assert ! ( Flags :: from_bits( 0 ) == Some ( Flags :: empty( ) ) ) ;
361- assert ! ( Flags :: from_bits( 0x1 ) == Some ( FlagA ) ) ;
362- assert ! ( Flags :: from_bits( 0x10 ) == Some ( FlagB ) ) ;
363- assert ! ( Flags :: from_bits( 0x11 ) == Some ( FlagA | FlagB ) ) ;
364- assert ! ( Flags :: from_bits( 0x1000 ) == None ) ;
361+ assert ! ( Flags :: from_bits( 0b1 ) == Some ( FlagA ) ) ;
362+ assert ! ( Flags :: from_bits( 0b10 ) == Some ( FlagB ) ) ;
363+ assert ! ( Flags :: from_bits( 0b11 ) == Some ( FlagA | FlagB ) ) ;
364+ assert ! ( Flags :: from_bits( 0b1000 ) == None ) ;
365365
366366 assert ! ( AnotherSetOfFlags :: from_bits( !0_i8 ) == Some ( AnotherFlag ) ) ;
367367 }
368368
369369 #[ test]
370370 fn test_from_bits_truncate ( ) {
371371 assert ! ( Flags :: from_bits_truncate( 0 ) == Flags :: empty( ) ) ;
372- assert ! ( Flags :: from_bits_truncate( 0x1 ) == FlagA ) ;
373- assert ! ( Flags :: from_bits_truncate( 0x10 ) == FlagB ) ;
374- assert ! ( Flags :: from_bits_truncate( 0x11 ) == ( FlagA | FlagB ) ) ;
375- assert ! ( Flags :: from_bits_truncate( 0x1000 ) == Flags :: empty( ) ) ;
376- assert ! ( Flags :: from_bits_truncate( 0x1001 ) == FlagA ) ;
372+ assert ! ( Flags :: from_bits_truncate( 0b1 ) == FlagA ) ;
373+ assert ! ( Flags :: from_bits_truncate( 0b10 ) == FlagB ) ;
374+ assert ! ( Flags :: from_bits_truncate( 0b11 ) == ( FlagA | FlagB ) ) ;
375+ assert ! ( Flags :: from_bits_truncate( 0b1000 ) == Flags :: empty( ) ) ;
376+ assert ! ( Flags :: from_bits_truncate( 0b1001 ) == FlagA ) ;
377377
378378 assert ! ( AnotherSetOfFlags :: from_bits_truncate( 0_i8 ) == AnotherSetOfFlags :: empty( ) ) ;
379379 }
0 commit comments