@@ -258,7 +258,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
258
258
' ' => flags. space = true ,
259
259
'.' => fstate = FormatStatePrecision ,
260
260
'0' ..'9' => {
261
- flags. width = ( cur - '0' ) as uint ;
261
+ flags. width = ( cur as uint - '0' as uint ) ;
262
262
fstate = FormatStateWidth ;
263
263
}
264
264
_ => util:: unreachable ( )
@@ -330,7 +330,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
330
330
state = Nothing ;
331
331
}
332
332
'0' ..'9' => {
333
- state = IntConstant ( i* 10 + ( ( cur - '0' ) as int ) ) ;
333
+ state = IntConstant ( i* 10 + ( cur as int - '0' as int ) ) ;
334
334
old_state = Nothing ;
335
335
}
336
336
_ => return Err ( ~"bad int constant")
@@ -358,23 +358,23 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
358
358
flags. space = true ;
359
359
}
360
360
( FormatStateFlags , '0' ..'9' ) => {
361
- flags. width = ( cur - '0' ) as uint ;
361
+ flags. width = ( cur as uint - '0' as uint ) ;
362
362
* fstate = FormatStateWidth ;
363
363
}
364
364
( FormatStateFlags , '.' ) => {
365
365
* fstate = FormatStatePrecision ;
366
366
}
367
367
( FormatStateWidth , '0' ..'9' ) => {
368
368
let old = flags. width ;
369
- flags. width = flags. width * 10 + ( ( cur - '0' ) as uint ) ;
369
+ flags. width = flags. width * 10 + ( cur as uint - '0' as uint ) ;
370
370
if flags. width < old { return Err ( ~"format width overflow") }
371
371
}
372
372
( FormatStateWidth , '.' ) => {
373
373
* fstate = FormatStatePrecision ;
374
374
}
375
375
( FormatStatePrecision , '0' ..'9' ) => {
376
376
let old = flags. precision ;
377
- flags. precision = flags. precision * 10 + ( ( cur - '0' ) as uint ) ;
377
+ flags. precision = flags. precision * 10 + ( cur as uint - '0' as uint ) ;
378
378
if flags. precision < old { return Err ( ~"format precision overflow") }
379
379
}
380
380
_ => return Err ( ~"invalid format specifier")
0 commit comments