mirror of
https://github.com/nushell/nushell
synced 2025-01-15 22:54:16 +00:00
cleanup + clippy suggestions
This commit is contained in:
parent
97ca242634
commit
beb15dcc77
1 changed files with 12 additions and 14 deletions
|
@ -1,11 +1,9 @@
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::env::current_dir;
|
use std::env::current_dir;
|
||||||
use std::os::unix::prelude::FileTypeExt;
|
use std::os::unix::prelude::FileTypeExt;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use glob::Paths;
|
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::{Call, Expression};
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::engine::{Command, EvaluationContext};
|
use nu_protocol::engine::{Command, EvaluationContext};
|
||||||
use nu_protocol::{ShellError, Signature, SyntaxShape, Value, ValueStream};
|
use nu_protocol::{ShellError, Signature, SyntaxShape, Value, ValueStream};
|
||||||
|
|
||||||
|
@ -144,7 +142,7 @@ fn rm(context: &EvaluationContext, call: &Call) -> Result<Value, ShellError> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rm_helper(call: &Call, args: RmArgs) -> Vec<Value> {
|
fn rm_helper(call: &Call, args: RmArgs) -> Vec<Value> {
|
||||||
let (targets, recursive, trash, permanent, force) = (
|
let (targets, recursive, trash, _permanent, force) = (
|
||||||
args.targets,
|
args.targets,
|
||||||
args.recursive,
|
args.recursive,
|
||||||
args.trash,
|
args.trash,
|
||||||
|
@ -219,33 +217,33 @@ fn rm_helper(call: &Call, args: RmArgs) -> Vec<Value> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
return Value::Error {
|
Value::Error {
|
||||||
error: ShellError::RemoveNotPossible(
|
error: ShellError::RemoveNotPossible(
|
||||||
format!("Could not delete because: {:}\nTry '--trash' flag", e),
|
format!("Could not delete because: {:}\nTry '--trash' flag", e),
|
||||||
call.head,
|
call.head,
|
||||||
),
|
),
|
||||||
};
|
}
|
||||||
} else {
|
} else {
|
||||||
return Value::String {
|
Value::String {
|
||||||
val: format!("deleted {:}", f.to_string_lossy()).into(),
|
val: format!("deleted {:}", f.to_string_lossy()),
|
||||||
span: call.positional[i].span,
|
span: call.positional[i].span,
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Value::Error {
|
Value::Error {
|
||||||
error: ShellError::RemoveNotPossible(
|
error: ShellError::RemoveNotPossible(
|
||||||
"Cannot remove. try --recursive".to_string(),
|
"Cannot remove. try --recursive".to_string(),
|
||||||
call.positional[i].span,
|
call.positional[i].span,
|
||||||
),
|
),
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Value::Error {
|
Value::Error {
|
||||||
error: ShellError::RemoveNotPossible(
|
error: ShellError::RemoveNotPossible(
|
||||||
"no such file or directory".to_string(),
|
"no such file or directory".to_string(),
|
||||||
call.positional[i].span,
|
call.positional[i].span,
|
||||||
),
|
),
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
|
Loading…
Reference in a new issue