Skip to content

Commit

Permalink
touchup some clippy warnings in tests (#6612)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiajt committed Sep 25, 2022
1 parent b47bd22 commit 43905ca
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions crates/nu-cli/tests/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn external_completer_trailing_space() {
let block = "let external_completer = {|spans| $spans}";
let input = "gh alias ".to_string();

let suggestions = run_external_completion(&block, &input);
let suggestions = run_external_completion(block, &input);
assert_eq!(3, suggestions.len());
assert_eq!("gh", suggestions.get(0).unwrap().value);
assert_eq!("alias", suggestions.get(1).unwrap().value);
Expand All @@ -126,7 +126,7 @@ fn external_completer_no_trailing_space() {
let block = "let external_completer = {|spans| $spans}";
let input = "gh alias".to_string();

let suggestions = run_external_completion(&block, &input);
let suggestions = run_external_completion(block, &input);
assert_eq!(2, suggestions.len());
assert_eq!("gh", suggestions.get(0).unwrap().value);
assert_eq!("alias", suggestions.get(1).unwrap().value);
Expand All @@ -137,7 +137,7 @@ fn external_completer_pass_flags() {
let block = "let external_completer = {|spans| $spans}";
let input = "gh api --".to_string();

let suggestions = run_external_completion(&block, &input);
let suggestions = run_external_completion(block, &input);
assert_eq!(3, suggestions.len());
assert_eq!("gh", suggestions.get(0).unwrap().value);
assert_eq!("api", suggestions.get(1).unwrap().value);
Expand Down Expand Up @@ -637,7 +637,7 @@ fn run_external_completion(block: &str, input: &str) -> Vec<Suggestion> {
// Instatiate a new completer
let mut completer = NuCompleter::new(std::sync::Arc::new(engine_state), stack);

completer.complete(&input, input.len())
completer.complete(input, input.len())
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/nu-command/tests/commands/source_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ fn can_source_dynamic_path() {
Playground::setup("can_source_dynamic_path", |dirs, sandbox| {
let foo_file = "foo.nu";

sandbox.with_files(vec![FileWithContent(&foo_file, "echo foo")]);
sandbox.with_files(vec![FileWithContent(foo_file, "echo foo")]);

let cmd = format!("let file = `{}`; source-env $file", foo_file);
let actual = nu!(cwd: dirs.test(), &cmd);
Expand Down
2 changes: 1 addition & 1 deletion crates/nu-command/tests/format_conversions/nuon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ proptest! {
}
#[test]
fn to_nuon_from_nuon_string(s: String) {
if s != "\\0" && s!= "" && !s.contains('\\') && !s.contains('"'){
if s != "\\0" && !s.is_empty() && !s.contains('\\') && !s.contains('"'){
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
format!(r#"
Expand Down
2 changes: 1 addition & 1 deletion crates/nu-plugin/benches/encoder_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use nu_protocol::{Span, Value};
// generate a new table data with `row_cnt` rows, `col_cnt` columns.
fn new_test_data(row_cnt: usize, col_cnt: usize) -> Value {
let columns: Vec<String> = (0..col_cnt).map(|x| format!("col_{x}")).collect();
let vals: Vec<Value> = (0..col_cnt as i64).map(|i| Value::test_int(i)).collect();
let vals: Vec<Value> = (0..col_cnt as i64).map(Value::test_int).collect();

Value::List {
vals: (0..row_cnt)
Expand Down
4 changes: 2 additions & 2 deletions crates/nu-test-support/tests/get_system_locale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ use num_format::Grouping;

#[test]
fn test_get_system_locale_en() {
let locale = with_locale_override("en_US.UTF-8", || get_system_locale());
let locale = with_locale_override("en_US.UTF-8", get_system_locale);

assert_eq!(locale.name(), "en");
assert_eq!(locale.grouping(), Grouping::Standard)
}

#[test]
fn test_get_system_locale_de() {
let locale = with_locale_override("de_DE.UTF-8", || get_system_locale());
let locale = with_locale_override("de_DE.UTF-8", get_system_locale);

assert_eq!(locale.name(), "de");
assert_eq!(locale.grouping(), Grouping::Standard)
Expand Down

0 comments on commit 43905ca

Please sign in to comment.