@@ -28,15 +28,9 @@ const META_BLOCK_SIZE: Sectors = Sectors(8);
2828#[ allow( dead_code) ]
2929const MAX_META_DEV_SIZE : MetaBlocks = MetaBlocks ( 255 * ( ( 1 << 14 ) - 64 ) ) ;
3030
31- range ! ( DataBlocks ) ;
31+ range ! ( DataBlocks , "data blocks" ) ;
3232
33- impl fmt:: Display for DataBlocks {
34- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
35- write ! ( f, "{} data blocks" , self . 0 )
36- }
37- }
38-
39- range ! ( MetaBlocks ) ;
33+ range ! ( MetaBlocks , "meta blocks" ) ;
4034
4135impl MetaBlocks {
4236 /// Return the number of Sectors in the MetaBlocks.
@@ -45,13 +39,7 @@ impl MetaBlocks {
4539 }
4640}
4741
48- impl fmt:: Display for MetaBlocks {
49- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
50- write ! ( f, "{} meta blocks" , self . 0 )
51- }
52- }
53-
54- range ! ( Bytes ) ;
42+ range ! ( Bytes , "bytes" ) ;
5543
5644impl Bytes {
5745 /// Return the number of Sectors fully contained in these bytes.
@@ -60,13 +48,7 @@ impl Bytes {
6048 }
6149}
6250
63- impl fmt:: Display for Bytes {
64- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
65- write ! ( f, "{} bytes" , self . 0 )
66- }
67- }
68-
69- range ! ( Sectors ) ;
51+ range ! ( Sectors , "sectors" ) ;
7052
7153impl Sectors {
7254 /// The number of bytes in these sectors.
@@ -80,12 +62,6 @@ impl Sectors {
8062 }
8163}
8264
83- impl fmt:: Display for Sectors {
84- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
85- write ! ( f, "{} sectors" , self . 0 )
86- }
87- }
88-
8965/// Returns an error if value is unsuitable.
9066fn str_check ( value : & str , max_allowed_chars : usize ) -> DmResult < ( ) > {
9167 if !value. is_ascii ( ) {
0 commit comments