Skip to content
Myr

Remove deprecated trim_left(_matches)?

Before adoption: this commit came in with the history the project adopted, so no landing records it.

warning: use of deprecated item 'core::str::<impl str>::trim_left_matches': superseded by `trim_start_matches` --> src/main.rs:222:28 | 222 | .map(|e| e.trim_left_matches('.')) | ^^^^^^^^^^^^^^^^^ | = note: #[warn(deprecated)] on by default

authored by Tim Holland · committed by David Peter · parent f3ec3d9 · Browse files · 4 files+5 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+5 added−5 removed

  • tests:+3 added−3 removed
  • other:+2 added−2 removed

4 files+5 added−5 removed

modified:src/fshelper/mod.rs+1 added-1 removed
30 unmodified lines
31 let path_buf = Path::new(32 path_buf33 .as_path()34 .to_string_lossy()35 .trim_left_matches(r"\\?\"),35 .trim_start_matches(r"\\?\"),36 )37 .to_path_buf();3839 Ok(path_buf)
35 unmodified lines
modified:src/main.rs+1 added-1 removed
217 unmodified lines
218 file_types219 }),220 extensions: matches.values_of("extension").map(|exts| {221 let patterns = exts222 .map(|e| e.trim_left_matches('.'))222 .map(|e| e.trim_start_matches('.'))223 .map(|e| format!(r".\.{}$", regex::escape(e)));224 match RegexSetBuilder::new(patterns)225 .case_insensitive(true)226 .build()
36 unmodified lines
modified:tests/testenv/mod.rs+2 added-2 removed
119 unmodified lines
120 )121}122123/// Normalize the output for comparison.124fn normalize_output(s: &str, trim_left: bool, normalize_line: bool) -> String {124fn normalize_output(s: &str, trim_start: bool, normalize_line: bool) -> String {125 // Split into lines and normalize separators.126 let mut lines = s127 .replace('\0', "NULL\n")128 .lines()129 .map(|line| {130 let line = if trim_left { line.trim_left() } else { line };130 let line = if trim_start { line.trim_start() } else { line };131 let line = line.replace('/', &std::path::MAIN_SEPARATOR.to_string());132 if normalize_line {133 let mut words: Vec<_> = line.split_whitespace().collect();134 words.sort();
109 unmodified lines
modified:tests/tests.rs+1 added-1 removed
39 unmodified lines
40 .expect("string")41 .to_string();4243 #[cfg(windows)]44 let path = path.trim_left_matches(r"\\?\").to_string();44 let path = path.trim_start_matches(r"\\?\").to_string();4546 path47}48
1185 unmodified lines