From 5bf1687fa7efad00a27569ba5c12591f69759e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Ribaud?= Date: Thu, 3 Sep 2020 10:47:48 +0200 Subject: [PATCH] Use trim_start_matches instead of strip_prefix (#1156) - This allow to not bump the pinned version to 1.45.0. - Change this, despite trim_start_matches returns a &str and not an Option, which I like less. --- azure-pipelines.yml | 2 +- src/cmd/init.rs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5aa51142..05d6173c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,7 +21,7 @@ stages: rustup_toolchain: stable linux-pinned: imageName: 'ubuntu-16.04' - rustup_toolchain: 1.45.0 + rustup_toolchain: 1.43.0 pool: vmImage: $(imageName) steps: diff --git a/src/cmd/init.rs b/src/cmd/init.rs index 6c1e823b..07f230e5 100644 --- a/src/cmd/init.rs +++ b/src/cmd/init.rs @@ -69,10 +69,7 @@ pub fn is_directory_quasi_empty(path: &Path) -> Result { // Remove the unc part of a windows path fn strip_unc(path: &PathBuf) -> String { let path_to_refine = path.to_str().unwrap(); - match path_to_refine.strip_prefix(LOCAL_UNC) { - Some(path_stripped) => path_stripped.to_string(), - None => path_to_refine.to_string(), - } + path_to_refine.trim_start_matches(LOCAL_UNC).to_string() } pub fn create_new_project(name: &str, force: bool) -> Result<()> {