Remove deprecated trim_left(_matches)?

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
This commit is contained in:
Tim Holland 2019-03-01 19:19:47 -05:00 committed by David Peter
parent f3ec3d9cf0
commit 074cfad3d4
4 changed files with 5 additions and 5 deletions

View File

@ -32,7 +32,7 @@ pub fn absolute_path(path: &Path) -> io::Result<PathBuf> {
path_buf
.as_path()
.to_string_lossy()
.trim_left_matches(r"\\?\"),
.trim_start_matches(r"\\?\"),
)
.to_path_buf();

View File

@ -219,7 +219,7 @@ fn main() {
}),
extensions: matches.values_of("extension").map(|exts| {
let patterns = exts
.map(|e| e.trim_left_matches('.'))
.map(|e| e.trim_start_matches('.'))
.map(|e| format!(r".\.{}$", regex::escape(e)));
match RegexSetBuilder::new(patterns)
.case_insensitive(true)

View File

@ -121,13 +121,13 @@ fn format_output_error(args: &[&str], expected: &str, actual: &str) -> String {
}
/// Normalize the output for comparison.
fn normalize_output(s: &str, trim_left: bool, normalize_line: bool) -> String {
fn normalize_output(s: &str, trim_start: bool, normalize_line: bool) -> String {
// Split into lines and normalize separators.
let mut lines = s
.replace('\0', "NULL\n")
.lines()
.map(|line| {
let line = if trim_left { line.trim_left() } else { line };
let line = if trim_start { line.trim_start() } else { line };
let line = line.replace('/', &std::path::MAIN_SEPARATOR.to_string());
if normalize_line {
let mut words: Vec<_> = line.split_whitespace().collect();

View File

@ -41,7 +41,7 @@ fn get_absolute_root_path(env: &TestEnv) -> String {
.to_string();
#[cfg(windows)]
let path = path.trim_left_matches(r"\\?\").to_string();
let path = path.trim_start_matches(r"\\?\").to_string();
path
}