mirror of
https://github.com/nushell/nushell.git
synced 2025-03-25 22:17:56 +01:00
Some cleanups for clippy (#5266)
This commit is contained in:
parent
d1cc70fc4a
commit
ded9d1cedb
@ -15,7 +15,7 @@ fn file_completions() {
|
|||||||
let stack = Stack::new();
|
let stack = Stack::new();
|
||||||
|
|
||||||
// Instatiate a new completer
|
// Instatiate a new completer
|
||||||
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack.clone());
|
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack);
|
||||||
|
|
||||||
// Test completions for the current folder
|
// Test completions for the current folder
|
||||||
let target_dir = format!("cd {}", dir_str);
|
let target_dir = format!("cd {}", dir_str);
|
||||||
@ -23,23 +23,23 @@ fn file_completions() {
|
|||||||
|
|
||||||
// Create the expected values
|
// Create the expected values
|
||||||
let expected_paths: Vec<String> = vec![
|
let expected_paths: Vec<String> = vec![
|
||||||
file(dir.clone().join("nushell")),
|
file(dir.join("nushell")),
|
||||||
folder(dir.clone().join("test_a")),
|
folder(dir.join("test_a")),
|
||||||
folder(dir.clone().join("test_b")),
|
folder(dir.join("test_b")),
|
||||||
folder(dir.clone().join("another")),
|
folder(dir.join("another")),
|
||||||
file(dir.clone().join(".hidden_file")),
|
file(dir.join(".hidden_file")),
|
||||||
folder(dir.clone().join(".hidden_folder")),
|
folder(dir.join(".hidden_folder")),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Match the results
|
// Match the results
|
||||||
match_suggestions(expected_paths, suggestions);
|
match_suggestions(expected_paths, suggestions);
|
||||||
|
|
||||||
// Test completions for the completions/another folder
|
// Test completions for the completions/another folder
|
||||||
let target_dir = format!("cd {}", folder(dir.clone().join("another")));
|
let target_dir = format!("cd {}", folder(dir.join("another")));
|
||||||
let suggestions = completer.complete(&target_dir, target_dir.len());
|
let suggestions = completer.complete(&target_dir, target_dir.len());
|
||||||
|
|
||||||
// Create the expected values
|
// Create the expected values
|
||||||
let expected_paths: Vec<String> = vec![file(dir.clone().join("another").join("newfile"))];
|
let expected_paths: Vec<String> = vec![file(dir.join("another").join("newfile"))];
|
||||||
|
|
||||||
// Match the results
|
// Match the results
|
||||||
match_suggestions(expected_paths, suggestions);
|
match_suggestions(expected_paths, suggestions);
|
||||||
@ -53,7 +53,7 @@ fn new_engine() -> (PathBuf, String, EngineState) {
|
|||||||
.clone()
|
.clone()
|
||||||
.into_os_string()
|
.into_os_string()
|
||||||
.into_string()
|
.into_string()
|
||||||
.unwrap_or("".to_string());
|
.unwrap_or_default();
|
||||||
dir_str.push(SEP);
|
dir_str.push(SEP);
|
||||||
|
|
||||||
// Create a default engine
|
// Create a default engine
|
||||||
@ -77,8 +77,5 @@ fn folder(path: PathBuf) -> String {
|
|||||||
|
|
||||||
// convert a given path to string
|
// convert a given path to string
|
||||||
fn file(path: PathBuf) -> String {
|
fn file(path: PathBuf) -> String {
|
||||||
path.clone()
|
path.into_os_string().into_string().unwrap_or_default()
|
||||||
.into_os_string()
|
|
||||||
.into_string()
|
|
||||||
.unwrap_or("".to_string())
|
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,3 @@ fn invalid_input_fails() {
|
|||||||
|
|
||||||
assert!(actual.err.contains("pipeline_mismatch"));
|
assert!(actual.err.contains("pipeline_mismatch"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn scratch() {
|
|
||||||
assert!(true);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user