diff --git a/crates/nu-cli/src/completions/command_completions.rs b/crates/nu-cli/src/completions/command_completions.rs index 2fa7b1fa4..b9427e8e8 100644 --- a/crates/nu-cli/src/completions/command_completions.rs +++ b/crates/nu-cli/src/completions/command_completions.rs @@ -315,9 +315,12 @@ mod command_completions_tests { working_set.render() }; - if let Err(err) = engine_state.merge_delta(delta) { - assert!(false, "Merge delta has failed: {}", err); - } + let result = engine_state.merge_delta(delta); + assert!( + result.is_ok(), + "Merge delta has failed: {}", + result.err().unwrap() + ); let is_passthrough_command = is_passthrough_command(engine_state.get_file_contents()); assert_eq!( diff --git a/crates/nu-cli/src/completions/completer.rs b/crates/nu-cli/src/completions/completer.rs index 524b23e02..d1cc7fd7f 100644 --- a/crates/nu-cli/src/completions/completer.rs +++ b/crates/nu-cli/src/completions/completer.rs @@ -596,9 +596,12 @@ mod completer_tests { working_set.render() }; - if let Err(err) = engine_state.merge_delta(delta) { - assert!(false, "Error merging delta: {:?}", err); - } + let result = engine_state.merge_delta(delta); + assert!( + result.is_ok(), + "Error merging delta: {:?}", + result.err().unwrap() + ); let mut completer = NuCompleter::new(engine_state.into(), Stack::new()); let dataset = vec![ @@ -617,7 +620,7 @@ mod completer_tests { for (line, has_result, begins_with, expected_values) in dataset { let result = completer.completion_helper(line, line.len()); // Test whether the result is empty or not - assert_eq!(result.len() > 0, has_result, "line: {}", line); + assert_eq!(!result.is_empty(), has_result, "line: {}", line); // Test whether the result begins with the expected value result @@ -629,7 +632,7 @@ mod completer_tests { result .iter() .map(|x| expected_values.contains(&x.value.as_str())) - .filter(|x| *x == true) + .filter(|x| *x) .count(), expected_values.len(), "line: {}", diff --git a/crates/nu-command/tests/commands/cp.rs b/crates/nu-command/tests/commands/cp.rs index 4852a1f2e..87f6bbe14 100644 --- a/crates/nu-command/tests/commands/cp.rs +++ b/crates/nu-command/tests/commands/cp.rs @@ -23,7 +23,7 @@ fn copies_a_file_impl(progress: bool) { let progress_flag = if progress { "-p" } else { "" }; // Get the hash of the file content to check integrity after copy. - let first_hash = get_file_hash(&test_file.display()); + let first_hash = get_file_hash(test_file.display()); nu!( cwd: dirs.root(), @@ -175,15 +175,15 @@ fn deep_copies_with_recursive_flag_impl(progress: bool) { assert!(expected_dir.exists()); assert!(files_exist_at( vec![Path::new("errors.txt"), Path::new("multishells.txt")], - &jonathans_expected_copied_dir + jonathans_expected_copied_dir )); assert!(files_exist_at( vec![Path::new("coverage.txt"), Path::new("commands.txt")], - &andres_expected_copied_dir + andres_expected_copied_dir )); assert!(files_exist_at( vec![Path::new("defer-evaluation.txt")], - &yehudas_expected_copied_dir + yehudas_expected_copied_dir )); }) } diff --git a/crates/nu-parser/tests/test_parser.rs b/crates/nu-parser/tests/test_parser.rs index d9758b804..f4c153479 100644 --- a/crates/nu-parser/tests/test_parser.rs +++ b/crates/nu-parser/tests/test_parser.rs @@ -83,7 +83,7 @@ fn test_int( }, ) = &expressions[0] { - compare_rhs_binaryOp(test_tag, &expected_val, &observed_val); + compare_rhs_binaryOp(test_tag, &expected_val, observed_val); } } }