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.
This commit is contained in:
René Ribaud 2020-09-03 10:47:48 +02:00 committed by GitHub
parent 2ac1d79f8f
commit 5bf1687fa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

@ -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:

View File

@ -69,10 +69,7 @@ pub fn is_directory_quasi_empty(path: &Path) -> Result<bool> {
// 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<()> {