]> git.lizzy.rs Git - rust.git/commitdiff
Dogfood
authormcarton <cartonmartin+git@gmail.com>
Sat, 12 Mar 2016 20:23:35 +0000 (21:23 +0100)
committermcarton <cartonmartin+git@gmail.com>
Sat, 12 Mar 2016 20:23:56 +0000 (21:23 +0100)
src/utils/mod.rs

index 625e8da197d573b2c93a14e44ae622a32b5d6c2e..ee2e2d7206f8d6c0b1b117725f17d9b2a6eeaf84 100644 (file)
@@ -383,14 +383,14 @@ fn trim_multiline_inner(s: Cow<str>, ignore_first: bool, ch: char) -> Cow<str> {
     let x = s.lines()
              .skip(ignore_first as usize)
              .filter_map(|l| {
-                 if l.len() > 0 {
+                 if l.is_empty() {
+                     None
+                 } else {
                      // ignore empty lines
                      Some(l.char_indices()
                            .find(|&(_, x)| x != ch)
                            .unwrap_or((l.len(), ch))
                            .0)
-                 } else {
-                     None
                  }
              })
              .min()
@@ -399,7 +399,7 @@ fn trim_multiline_inner(s: Cow<str>, ignore_first: bool, ch: char) -> Cow<str> {
         Cow::Owned(s.lines()
                     .enumerate()
                     .map(|(i, l)| {
-                        if (ignore_first && i == 0) || l.len() == 0 {
+                        if (ignore_first && i == 0) || l.is_empty() {
                             l
                         } else {
                             l.split_at(x).1