Merge pull request #333 from jonathandturner/tiny_cleanup

Remove an unwrap
This commit is contained in:
Jonathan Turner 2019-08-23 06:39:49 +12:00 committed by GitHub
commit 4f52eb0a6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -135,7 +135,11 @@ impl Shell for FilesystemShell {
// Enumerate the entries from the glob and add each
for entry in entries {
if let Ok(entry) = entry {
let filename = entry.strip_prefix(&cwd).unwrap();
let filename = if let Ok(fname) = entry.strip_prefix(&cwd) {
fname
} else {
Path::new(&entry)
};
let metadata = std::fs::metadata(&entry)?;
let value = dir_entry_dict(
filename,