@@ -198,11 +198,11 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
198
198
// Decide what sign to put in front
199
199
match sign {
200
200
SignNeg | SignAll if neg => {
201
- buf[ end] = '-' as u8 ;
201
+ buf[ end] = b '-';
202
202
end += 1 ;
203
203
}
204
204
SignAll => {
205
- buf[ end] = '+' as u8 ;
205
+ buf[ end] = b '+';
206
206
end += 1 ;
207
207
}
208
208
_ => ( )
@@ -218,7 +218,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
218
218
// Now emit the fractional part, if any
219
219
deccum = num. fract ( ) ;
220
220
if deccum != _0 || ( limit_digits && exact && digit_count > 0 ) {
221
- buf[ end] = '.' as u8 ;
221
+ buf[ end] = b '.';
222
222
end += 1 ;
223
223
let mut dig = 0 u;
224
224
@@ -269,8 +269,8 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
269
269
// If reached left end of number, have to
270
270
// insert additional digit:
271
271
if i < 0
272
- || buf[ i as uint ] == '-' as u8
273
- || buf[ i as uint ] == '+' as u8 {
272
+ || buf[ i as uint ] == b '-'
273
+ || buf[ i as uint ] == b '+' {
274
274
for j in range ( i as uint + 1 , end) . rev ( ) {
275
275
buf[ j + 1 ] = buf[ j] ;
276
276
}
@@ -280,7 +280,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
280
280
}
281
281
282
282
// Skip the '.'
283
- if buf[ i as uint ] == '.' as u8 { i -= 1 ; continue ; }
283
+ if buf[ i as uint ] == b '.' { i -= 1 ; continue ; }
284
284
285
285
// Either increment the digit,
286
286
// or set to 0 if max and carry the 1.
@@ -306,14 +306,14 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
306
306
let mut i = buf_max_i;
307
307
308
308
// discover trailing zeros of fractional part
309
- while i > start_fractional_digits && buf[ i] == '0' as u8 {
309
+ while i > start_fractional_digits && buf[ i] == b '0' {
310
310
i -= 1 ;
311
311
}
312
312
313
313
// Only attempt to truncate digits if buf has fractional digits
314
314
if i >= start_fractional_digits {
315
315
// If buf ends with '.', cut that too.
316
- if buf[ i] == '.' as u8 { i -= 1 }
316
+ if buf[ i] == b '.' { i -= 1 }
317
317
318
318
// only resize buf if we actually remove digits
319
319
if i < buf_max_i {
@@ -323,7 +323,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
323
323
} // If exact and trailing '.', just cut that
324
324
else {
325
325
let max_i = end - 1 ;
326
- if buf[ max_i] == '.' as u8 {
326
+ if buf[ max_i] == b '.' {
327
327
end = max_i;
328
328
}
329
329
}
0 commit comments