Clippy and remove unused is_binary (#5879)

This commit is contained in:
JT 2022-06-26 08:20:28 +12:00 committed by GitHub
parent ef9b72d360
commit 575ddbd4ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 28 deletions

View File

@ -10,7 +10,7 @@ fn alias_of_command_and_flags() {
// Create an alias
let alias = r#"alias ll = ls -l"#;
assert!(support::merge_input(alias.as_bytes(), &mut engine, &mut stack, dir.clone()).is_ok());
assert!(support::merge_input(alias.as_bytes(), &mut engine, &mut stack, dir).is_ok());
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack);
@ -29,7 +29,7 @@ fn alias_of_basic_command() {
// Create an alias
let alias = r#"alias ll = ls "#;
assert!(support::merge_input(alias.as_bytes(), &mut engine, &mut stack, dir.clone()).is_ok());
assert!(support::merge_input(alias.as_bytes(), &mut engine, &mut stack, dir).is_ok());
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack);
@ -51,7 +51,7 @@ fn alias_of_another_alias() {
assert!(support::merge_input(alias.as_bytes(), &mut engine, &mut stack, dir.clone()).is_ok());
// Create the second alias
let alias = r#"alias lf = ll -f"#;
assert!(support::merge_input(alias.as_bytes(), &mut engine, &mut stack, dir.clone()).is_ok());
assert!(support::merge_input(alias.as_bytes(), &mut engine, &mut stack, dir).is_ok());
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack);

View File

@ -47,8 +47,8 @@ fn command_ls_completion() {
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack);
let target_dir = format!("ls ");
let suggestions = completer.complete(&target_dir, target_dir.len());
let target_dir = "ls ";
let suggestions = completer.complete(target_dir, target_dir.len());
#[cfg(windows)]
let expected_paths: Vec<String> = vec![
@ -79,8 +79,8 @@ fn command_open_completion() {
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack);
let target_dir = format!("open ");
let suggestions = completer.complete(&target_dir, target_dir.len());
let target_dir = "open ";
let suggestions = completer.complete(target_dir, target_dir.len());
#[cfg(windows)]
let expected_paths: Vec<String> = vec![
@ -112,8 +112,8 @@ fn command_rm_completion() {
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack);
let target_dir = format!("rm ");
let suggestions = completer.complete(&target_dir, target_dir.len());
let target_dir = "rm ";
let suggestions = completer.complete(target_dir, target_dir.len());
#[cfg(windows)]
let expected_paths: Vec<String> = vec![
@ -145,8 +145,8 @@ fn command_cp_completion() {
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack);
let target_dir = format!("cp ");
let suggestions = completer.complete(&target_dir, target_dir.len());
let target_dir = "cp ";
let suggestions = completer.complete(target_dir, target_dir.len());
#[cfg(windows)]
let expected_paths: Vec<String> = vec![
@ -178,8 +178,8 @@ fn command_save_completion() {
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack);
let target_dir = format!("save ");
let suggestions = completer.complete(&target_dir, target_dir.len());
let target_dir = "save ";
let suggestions = completer.complete(target_dir, target_dir.len());
#[cfg(windows)]
let expected_paths: Vec<String> = vec![
@ -211,8 +211,8 @@ fn command_touch_completion() {
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack);
let target_dir = format!("touch ");
let suggestions = completer.complete(&target_dir, target_dir.len());
let target_dir = "touch ";
let suggestions = completer.complete(target_dir, target_dir.len());
#[cfg(windows)]
let expected_paths: Vec<String> = vec![
@ -244,8 +244,8 @@ fn command_watch_completion() {
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack);
let target_dir = format!("watch ");
let suggestions = completer.complete(&target_dir, target_dir.len());
let target_dir = "watch ";
let suggestions = completer.complete(target_dir, target_dir.len());
#[cfg(windows)]
let expected_paths: Vec<String> = vec![

View File

@ -1033,12 +1033,6 @@ pub fn create_scope(
span,
});
cols.push("is_binary".to_string());
vals.push(Value::Bool {
val: decl.is_binary(),
span,
});
cols.push("is_builtin".to_string());
// we can only be a is_builtin or is_custom, not both
vals.push(Value::Bool {

View File

@ -986,7 +986,7 @@ mod input_types {
fn add_declations(engine_state: &mut EngineState) {
let delta = {
let mut working_set = StateWorkingSet::new(&engine_state);
let mut working_set = StateWorkingSet::new(engine_state);
working_set.add_decl(Box::new(Let));
working_set.add_decl(Box::new(AggCustom));
working_set.add_decl(Box::new(GroupByCustom));

View File

@ -23,10 +23,6 @@ pub trait Command: Send + Sync + CommandClone {
input: PipelineData,
) -> Result<PipelineData, ShellError>;
fn is_binary(&self) -> bool {
false
}
fn examples(&self) -> Vec<Example> {
Vec::new()
}