File tree Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ impl<'a> Parser<'a> {
190190 /// String, but I think it does when this eventually uses conditions so it
191191 /// might as well start using it now.
192192 fn err ( & mut self , msg : & str ) {
193- self . errors . push ( msg. to_string ( ) ) ;
193+ self . errors . push ( msg. to_owned ( ) ) ;
194194 }
195195
196196 /// Optionally consumes the specified character. If the character is not at
@@ -353,7 +353,7 @@ impl<'a> Parser<'a> {
353353 } else {
354354 spec. ty = self . word ( ) ;
355355 }
356- return spec;
356+ spec
357357 }
358358
359359 /// Parses a Count parameter at the current position. This does not check
@@ -417,25 +417,19 @@ impl<'a> Parser<'a> {
417417 fn integer ( & mut self ) -> Option < usize > {
418418 let mut cur = 0 ;
419419 let mut found = false ;
420- loop {
421- match self . cur . clone ( ) . next ( ) {
422- Some ( ( _, c) ) => {
423- match c. to_digit ( 10 ) {
424- Some ( i) => {
425- cur = cur * 10 + i as usize ;
426- found = true ;
427- self . cur . next ( ) ;
428- }
429- None => { break }
430- }
431- }
432- None => { break }
420+ while let Some ( ( _, c) ) = self . cur . clone ( ) . next ( ) {
421+ if let Some ( i) = c. to_digit ( 10 ) {
422+ cur = cur * 10 + i as usize ;
423+ found = true ;
424+ self . cur . next ( ) ;
425+ } else {
426+ break
433427 }
434428 }
435429 if found {
436- return Some ( cur) ;
430+ Some ( cur)
437431 } else {
438- return None ;
432+ None
439433 }
440434 }
441435}
You can’t perform that action at this time.
0 commit comments