@@ -131,11 +131,8 @@ pub enum Attribute {
131131 StrikeThrough = 8 ,
132132}
133133
134- #[ derive( Clone , Copy , PartialEq , Eq ) ]
135- struct Attributes ( u16 ) ;
136-
137- impl Attributes {
138- const ATTRIBUTES_LOOKUP : [ Attribute ; 9 ] = [
134+ impl Attribute {
135+ const MAP : [ Attribute ; 9 ] = [
139136 Attribute :: Bold ,
140137 Attribute :: Dim ,
141138 Attribute :: Italic ,
@@ -146,10 +143,15 @@ impl Attributes {
146143 Attribute :: Hidden ,
147144 Attribute :: StrikeThrough ,
148145 ] ;
146+ }
149147
148+ #[ derive( Clone , Copy , PartialEq , Eq ) ]
149+ struct Attributes ( u16 ) ;
150+
151+ impl Attributes {
150152 #[ inline]
151153 const fn new ( ) -> Self {
152- Attributes ( 0 )
154+ Self ( 0 )
153155 }
154156
155157 #[ inline]
@@ -173,7 +175,7 @@ impl Attributes {
173175
174176 #[ inline]
175177 fn attrs ( self ) -> impl Iterator < Item = Attribute > {
176- self . bits ( ) . map ( |bit| Self :: ATTRIBUTES_LOOKUP [ bit as usize ] )
178+ self . bits ( ) . map ( |bit| Attribute :: MAP [ bit as usize ] )
177179 }
178180}
179181
@@ -1021,7 +1023,7 @@ fn test_pad_str_with() {
10211023
10221024#[ test]
10231025fn test_attributes_single ( ) {
1024- for attr in Attributes :: ATTRIBUTES_LOOKUP {
1026+ for attr in Attribute :: MAP {
10251027 let attrs = Attributes :: new ( ) . insert ( attr) ;
10261028 assert_eq ! ( attrs. bits( ) . collect:: <Vec <_>>( ) , [ attr as u16 ] ) ;
10271029 assert_eq ! ( attrs. ansi_nums( ) . collect:: <Vec <_>>( ) , [ attr as u16 + 1 ] ) ;
@@ -1046,7 +1048,7 @@ fn test_attributes_many() {
10461048 Attribute :: Reverse ,
10471049 Attribute :: StrikeThrough ,
10481050 ] ,
1049- & Attributes :: ATTRIBUTES_LOOKUP ,
1051+ & Attribute :: MAP ,
10501052 ] ;
10511053 for test_attrs in tests {
10521054 let mut attrs = Attributes :: new ( ) ;
0 commit comments