]> git.lizzy.rs Git - rust.git/commitdiff
fmt: simplify parse_count
authorAndrew Paseltiner <apaseltiner@gmail.com>
Mon, 7 Jan 2013 19:41:37 +0000 (14:41 -0500)
committerAndrew Paseltiner <apaseltiner@gmail.com>
Mon, 7 Jan 2013 22:22:01 +0000 (17:22 -0500)
src/libcore/extfmt.rs

index 25e349f0dc321a24029d659505bbc9e9fce88020..1216d96530062bf5dae5affc68b9a1e70044c9db 100644 (file)
@@ -264,7 +264,7 @@ pub fn parse_flags(s: &str, i: uint, lim: uint) ->
     }
         pub fn parse_count(s: &str, i: uint, lim: uint)
         -> Parsed<Count> {
-        return if i >= lim {
+            if i >= lim {
                 Parsed::new(CountImplied, i)
             } else if s[i] == '*' as u8 {
                 let param = parse_parameter(s, i + 1, lim);
@@ -274,15 +274,14 @@ pub fn parse_count(s: &str, i: uint, lim: uint)
                   Some(n) => Parsed::new(CountIsParam(n), j)
                 }
             } else {
-                let num = peek_num(s, i, lim);
-                match num {
+                match peek_num(s, i, lim) {
                   None => Parsed::new(CountImplied, i),
                   Some(num) => Parsed::new(
                     CountIs(num.val),
                     num.next
                   )
                 }
-            };
+            }
     }
     pub fn parse_precision(s: &str, i: uint, lim: uint) ->
        Parsed<Count> {