@@ -49,11 +49,8 @@ pub fn demangle(s: &str) -> Result<(Demangle, &str), Invalid> {
49
49
parser. skip_path ( ) ?;
50
50
51
51
// Instantiating crate (paths always start with uppercase characters).
52
- match parser. sym . as_bytes ( ) . get ( parser. next ) {
53
- Some ( & ( b'A' ..=b'Z' ) ) => {
54
- parser. skip_path ( ) ?;
55
- }
56
- _ => { }
52
+ if let Some ( & ( b'A' ..=b'Z' ) ) = parser. sym . as_bytes ( ) . get ( parser. next ) {
53
+ parser. skip_path ( ) ?;
57
54
}
58
55
59
56
Ok ( ( Demangle { inner } , & parser. sym [ parser. next ..] ) )
@@ -374,14 +371,9 @@ impl<'s> Parser<'s> {
374
371
let is_punycode = self . eat ( b'u' ) ;
375
372
let mut len = self . digit_10 ( ) ? as usize ;
376
373
if len != 0 {
377
- loop {
378
- match self . digit_10 ( ) {
379
- Ok ( d) => {
380
- len = len. checked_mul ( 10 ) . ok_or ( Invalid ) ?;
381
- len = len. checked_add ( d as usize ) . ok_or ( Invalid ) ?;
382
- }
383
- Err ( Invalid ) => break ,
384
- }
374
+ while let Ok ( d) = self . digit_10 ( ) {
375
+ len = len. checked_mul ( 10 ) . ok_or ( Invalid ) ?;
376
+ len = len. checked_add ( d as usize ) . ok_or ( Invalid ) ?;
385
377
}
386
378
}
387
379
@@ -772,9 +764,8 @@ impl<'a, 'b, 's> Printer<'a, 'b, 's> {
772
764
fn print_type ( & mut self ) -> fmt:: Result {
773
765
let tag = parse ! ( self , next) ;
774
766
775
- match basic_type ( tag) {
776
- Some ( ty) => return self . out . write_str ( ty) ,
777
- None => { }
767
+ if let Some ( ty) = basic_type ( tag) {
768
+ return self . out . write_str ( ty) ;
778
769
}
779
770
780
771
match tag {
@@ -840,22 +831,19 @@ impl<'a, 'b, 's> Printer<'a, 'b, 's> {
840
831
this. out . write_str ( "unsafe " ) ?;
841
832
}
842
833
843
- match abi {
844
- Some ( abi) => {
845
- this. out . write_str ( "extern \" " ) ?;
846
-
847
- // If the ABI had any `-`, they were replaced with `_`,
848
- // so the parts between `_` have to be re-joined with `-`.
849
- let mut parts = abi. split ( '_' ) ;
850
- this. out . write_str ( parts. next ( ) . unwrap ( ) ) ?;
851
- for part in parts {
852
- this. out . write_str ( "-" ) ?;
853
- this. out . write_str ( part) ?;
854
- }
834
+ if let Some ( abi) = abi {
835
+ this. out . write_str ( "extern \" " ) ?;
855
836
856
- this. out . write_str ( "\" " ) ?;
837
+ // If the ABI had any `-`, they were replaced with `_`,
838
+ // so the parts between `_` have to be re-joined with `-`.
839
+ let mut parts = abi. split ( '_' ) ;
840
+ this. out . write_str ( parts. next ( ) . unwrap ( ) ) ?;
841
+ for part in parts {
842
+ this. out . write_str ( "-" ) ?;
843
+ this. out . write_str ( part) ?;
857
844
}
858
- None => { }
845
+
846
+ this. out . write_str ( "\" " ) ?;
859
847
}
860
848
861
849
this. out . write_str ( "fn(" ) ?;
0 commit comments