@@ -92,21 +92,17 @@ define_nb_types!(Int Long LongLong Float Double LongDouble UInt ULong ULongLong)
9292impl fmt:: Display for Number {
9393 #[ inline]
9494 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
95- write ! (
96- f,
97- "{}" ,
98- match self {
99- Self :: Int ( x) => x. to_string( ) ,
100- Self :: Long ( x) => x. to_string( ) ,
101- Self :: LongLong ( x) => x. to_string( ) ,
102- Self :: Float ( x) => x. to_string( ) ,
103- Self :: Double ( x) => x. to_string( ) ,
104- Self :: LongDouble ( x) => format!( "'{}'" , * x as f64 ) ,
105- Self :: UInt ( x) => x. to_string( ) ,
106- Self :: ULong ( x) => x. to_string( ) ,
107- Self :: ULongLong ( x) => x. to_string( ) ,
108- }
109- )
95+ write ! ( f, "{}" , match self {
96+ Self :: Int ( x) => x. to_string( ) ,
97+ Self :: Long ( x) => x. to_string( ) ,
98+ Self :: LongLong ( x) => x. to_string( ) ,
99+ Self :: Float ( x) => x. to_string( ) ,
100+ Self :: Double ( x) => x. to_string( ) ,
101+ Self :: LongDouble ( x) => format!( "'{}'" , * x as f64 ) ,
102+ Self :: UInt ( x) => x. to_string( ) ,
103+ Self :: ULong ( x) => x. to_string( ) ,
104+ Self :: ULongLong ( x) => x. to_string( ) ,
105+ } )
110106 }
111107}
112108
@@ -134,7 +130,7 @@ impl NumberType {
134130 Self :: UInt => Self :: ULong ,
135131 Self :: ULong => Self :: ULongLong ,
136132 Self :: ULongLong | Self :: LongLong | Self :: Float | Self :: Double | Self :: LongDouble => {
137- return None
133+ return None ;
138134 }
139135 } )
140136 }
@@ -170,20 +166,16 @@ impl NumberType {
170166impl fmt:: Display for NumberType {
171167 #[ inline]
172168 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
173- write ! (
174- f,
175- "{}" ,
176- match self {
177- Self :: Int => "int" ,
178- Self :: Long => "long" ,
179- Self :: LongLong => "long long" ,
180- Self :: Float => "float" ,
181- Self :: Double => "double" ,
182- Self :: LongDouble => "long double" ,
183- Self :: UInt => "unsigned int" ,
184- Self :: ULong => "unsigned long" ,
185- Self :: ULongLong => "unsigned long long" ,
186- }
187- )
169+ write ! ( f, "{}" , match self {
170+ Self :: Int => "int" ,
171+ Self :: Long => "long" ,
172+ Self :: LongLong => "long long" ,
173+ Self :: Float => "float" ,
174+ Self :: Double => "double" ,
175+ Self :: LongDouble => "long double" ,
176+ Self :: UInt => "unsigned int" ,
177+ Self :: ULong => "unsigned long" ,
178+ Self :: ULongLong => "unsigned long long" ,
179+ } )
188180 }
189181}
0 commit comments