diff --git a/src/expand/expand.rs b/src/expand/expand.rs index 017e7a28e..d0b13f6cf 100644 --- a/src/expand/expand.rs +++ b/src/expand/expand.rs @@ -146,7 +146,7 @@ fn next_tabstop(tabstops: &[usize], col: usize) -> usize { if tabstops.len() == 1 { tabstops[0] - col % tabstops[0] } else { - match tabstops.iter().skip_while(|&&t| t <= col).next() { + match tabstops.iter().find(|&&t| t > col) { Some(t) => t - col, None => 1, } diff --git a/src/mv/mv.rs b/src/mv/mv.rs index 445a2e4e9..807acedee 100644 --- a/src/mv/mv.rs +++ b/src/mv/mv.rs @@ -416,8 +416,7 @@ fn simple_backup_path(path: &PathBuf, suffix: &str) -> PathBuf { fn numbered_backup_path(path: &PathBuf) -> PathBuf { (1_u64..) .map(|i| path.with_extension(format!("~{}~", i))) - .skip_while(|p| p.exists()) - .next() + .find(|p| !p.exists()) .expect("cannot create backup") } diff --git a/src/sort/sort.rs b/src/sort/sort.rs index bddf26479..8340778b0 100644 --- a/src/sort/sort.rs +++ b/src/sort/sort.rs @@ -411,10 +411,8 @@ fn numeric_compare(a: &str, b: &str) -> Ordering { } fn human_numeric_convert(a: &str) -> f64 { - let int_iter = a.chars(); - let suffix_iter = a.chars(); - let int_str: String = int_iter.take_while(|c| c.is_numeric()).collect(); - let suffix = suffix_iter.skip_while(|c| c.is_numeric()).next(); + let int_str: String = a.chars().take_while(|c| c.is_numeric()).collect(); + let suffix = a.chars().find(|c| !c.is_numeric()); let int_part = match int_str.parse::() { Ok(i) => i, Err(_) => -1f64, diff --git a/src/unexpand/unexpand.rs b/src/unexpand/unexpand.rs index 15d380633..3c680f8c4 100644 --- a/src/unexpand/unexpand.rs +++ b/src/unexpand/unexpand.rs @@ -164,7 +164,7 @@ fn next_tabstop(tabstops: &[usize], col: usize) -> Option { Some(tabstops[0] - col % tabstops[0]) } else { // find next larger tab - match tabstops.iter().skip_while(|&&t| t <= col).next() { + match tabstops.iter().find(|&&t| t > col) { Some(t) => Some(t - col), None => None, // if there isn't one in the list, tab becomes a single space }