From 87930ba35aa23901aa6c67977fe015565f89ec51 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 22 Aug 2019 16:23:57 +1200 Subject: [PATCH] Fix tests --- src/shell/filesystem_shell.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/shell/filesystem_shell.rs b/src/shell/filesystem_shell.rs index e7038c40c4..98f51d0959 100644 --- a/src/shell/filesystem_shell.rs +++ b/src/shell/filesystem_shell.rs @@ -831,13 +831,7 @@ impl Shell for FilesystemShell { ) -> Result, ShellError> { let name_span = name; - let mut path = PathBuf::from(path); - - path.push(&target.item); - - let file = path.to_string_lossy(); - - if file == "." || file == ".." { + if target.item.to_str() == Some(".") || target.item.to_str() == Some("..") { return Err(ShellError::labeled_error( "Remove aborted. \".\" or \"..\" may not be removed.", "Remove aborted. \".\" or \"..\" may not be removed.", @@ -845,6 +839,12 @@ impl Shell for FilesystemShell { )); } + let mut path = PathBuf::from(path); + + path.push(&target.item); + + let file = path.to_string_lossy(); + let entries: Vec<_> = match glob::glob(&path.to_string_lossy()) { Ok(files) => files.collect(), Err(_) => {