about summary refs log tree commit diff
path: root/src/libfmt_macros
diff options
context:
space:
mode:
authorllogiq <bogusandre@gmail.com>2015-09-02 12:13:10 +0200
committerllogiq <bogusandre@gmail.com>2015-09-02 12:13:10 +0200
commit2a65474221f9b18fdf3b3309024bafc3c38e95fd (patch)
tree1ec4b22d02c127586668a680cf27477346df9e79 /src/libfmt_macros
parent0dbbab904916236d59446b9f51944a057e7b9966 (diff)
downloadrust-2a65474221f9b18fdf3b3309024bafc3c38e95fd.tar.gz
rust-2a65474221f9b18fdf3b3309024bafc3c38e95fd.zip
Improved libfmt_macros code style with clippy
Diffstat (limited to 'src/libfmt_macros')
-rw-r--r--src/libfmt_macros/lib.rs28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs
index 69438204730..32a5bd906fc 100644
--- a/src/libfmt_macros/lib.rs
+++ b/src/libfmt_macros/lib.rs
@@ -190,7 +190,7 @@ impl<'a> Parser<'a> {
     /// String, but I think it does when this eventually uses conditions so it
     /// might as well start using it now.
     fn err(&mut self, msg: &str) {
-        self.errors.push(msg.to_string());
+        self.errors.push(msg.to_owned());
     }
 
     /// Optionally consumes the specified character. If the character is not at
@@ -353,7 +353,7 @@ impl<'a> Parser<'a> {
         } else {
             spec.ty = self.word();
         }
-        return spec;
+        spec
     }
 
     /// Parses a Count parameter at the current position. This does not check
@@ -417,25 +417,19 @@ impl<'a> Parser<'a> {
     fn integer(&mut self) -> Option<usize> {
         let mut cur = 0;
         let mut found = false;
-        loop {
-            match self.cur.clone().next() {
-                Some((_, c)) => {
-                    match c.to_digit(10) {
-                        Some(i) => {
-                            cur = cur * 10 + i as usize;
-                            found = true;
-                            self.cur.next();
-                        }
-                        None => { break }
-                    }
-                }
-                None => { break }
+        while let Some((_, c)) = self.cur.clone().next() {
+            if let Some(i) = c.to_digit(10) {
+                cur = cur * 10 + i as usize;
+                found = true;
+                self.cur.next();
+            } else {
+                break
             }
         }
         if found {
-            return Some(cur);
+            Some(cur)
         } else {
-            return None;
+            None
         }
     }
 }