@@ -385,7 +385,7 @@ pub mod printf {
385
385
if let Start = state {
386
386
match c {
387
387
'1' ..='9' => {
388
- let end = at_next_cp_while ( next, is_digit ) ;
388
+ let end = at_next_cp_while ( next, char :: is_ascii_digit ) ;
389
389
match end. next_cp ( ) {
390
390
// Yes, this *is* the parameter.
391
391
Some ( ( '$' , end2) ) => {
@@ -427,7 +427,7 @@ pub mod printf {
427
427
move_to ! ( next) ;
428
428
}
429
429
'1' ..='9' => {
430
- let end = at_next_cp_while ( next, is_digit ) ;
430
+ let end = at_next_cp_while ( next, char :: is_ascii_digit ) ;
431
431
state = Prec ;
432
432
width = Some ( Num :: from_str ( at. slice_between ( end) . unwrap ( ) , None ) ) ;
433
433
move_to ! ( end) ;
@@ -441,7 +441,7 @@ pub mod printf {
441
441
}
442
442
443
443
if let WidthArg = state {
444
- let end = at_next_cp_while ( at, is_digit ) ;
444
+ let end = at_next_cp_while ( at, char :: is_ascii_digit ) ;
445
445
match end. next_cp ( ) {
446
446
Some ( ( '$' , end2) ) => {
447
447
state = Prec ;
@@ -473,7 +473,7 @@ pub mod printf {
473
473
if let PrecInner = state {
474
474
match c {
475
475
'*' => {
476
- let end = at_next_cp_while ( next, is_digit ) ;
476
+ let end = at_next_cp_while ( next, char :: is_ascii_digit ) ;
477
477
match end. next_cp ( ) {
478
478
Some ( ( '$' , end2) ) => {
479
479
state = Length ;
@@ -488,7 +488,7 @@ pub mod printf {
488
488
}
489
489
}
490
490
'0' ..='9' => {
491
- let end = at_next_cp_while ( next, is_digit ) ;
491
+ let end = at_next_cp_while ( next, char :: is_ascii_digit ) ;
492
492
state = Length ;
493
493
precision = Some ( Num :: from_str ( at. slice_between ( end) . unwrap ( ) , None ) ) ;
494
494
move_to ! ( end) ;
@@ -563,12 +563,12 @@ pub mod printf {
563
563
564
564
fn at_next_cp_while < F > ( mut cur : Cur < ' _ > , mut pred : F ) -> Cur < ' _ >
565
565
where
566
- F : FnMut ( char ) -> bool ,
566
+ F : FnMut ( & char ) -> bool ,
567
567
{
568
568
loop {
569
569
match cur. next_cp ( ) {
570
570
Some ( ( c, next) ) => {
571
- if pred ( c) {
571
+ if pred ( & c) {
572
572
cur = next;
573
573
} else {
574
574
return cur;
@@ -579,14 +579,7 @@ pub mod printf {
579
579
}
580
580
}
581
581
582
- fn is_digit ( c : char ) -> bool {
583
- match c {
584
- '0' ..='9' => true ,
585
- _ => false ,
586
- }
587
- }
588
-
589
- fn is_flag ( c : char ) -> bool {
582
+ fn is_flag ( c : & char ) -> bool {
590
583
match c {
591
584
'0' | '-' | '+' | ' ' | '#' | '\'' => true ,
592
585
_ => false ,
0 commit comments