From e7af7d291a2a0aa8060f3d7b9ea945a255131f24 Mon Sep 17 00:00:00 2001 From: Christoph Burgdorf Date: Mon, 27 Mar 2023 14:20:03 +0200 Subject: [PATCH] Make clippy happy --- crates/analyzer/src/traversal/expressions.rs | 2 +- crates/fe/src/task/test.rs | 16 ++++++++-------- crates/test-runner/src/lib.rs | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/analyzer/src/traversal/expressions.rs b/crates/analyzer/src/traversal/expressions.rs index d1e9e49f03..d5edbae6cc 100644 --- a/crates/analyzer/src/traversal/expressions.rs +++ b/crates/analyzer/src/traversal/expressions.rs @@ -1381,7 +1381,7 @@ fn expr_call_pure( if function.is_test(context.db()) { context.fancy_error( - &format!("`{}` is a test function", fn_name), + &format!("`{fn_name}` is a test function"), vec![Label::primary(call_span, "test functions are not callable")], vec![], ); diff --git a/crates/fe/src/task/test.rs b/crates/fe/src/task/test.rs index 0342321133..d35ac88d38 100644 --- a/crates/fe/src/task/test.rs +++ b/crates/fe/src/task/test.rs @@ -26,7 +26,7 @@ pub fn test(args: TestArgs) { test_ingot(&args) }; - println!("{}", test_sink); + println!("{test_sink}"); if test_sink.failure_count() != 0 { std::process::exit(1) } @@ -38,7 +38,7 @@ fn test_single_file(args: &TestArgs) -> TestSink { let mut db = fe_driver::Db::default(); let content = match std::fs::read_to_string(input_path) { Err(err) => { - eprintln!("Failed to load file: `{}`. Error: {}", input_path, err); + eprintln!("Failed to load file: `{input_path}`. Error: {err}"); std::process::exit(1) } Ok(content) => content, @@ -51,7 +51,7 @@ fn test_single_file(args: &TestArgs) -> TestSink { sink } Err(error) => { - eprintln!("Unable to compile {}.", input_path); + eprintln!("Unable to compile {input_path}."); print_diagnostics(&db, &error.0); std::process::exit(1) } @@ -60,7 +60,7 @@ fn test_single_file(args: &TestArgs) -> TestSink { pub fn execute_tests(module_name: &str, tests: &[CompiledTest], sink: &mut TestSink) { if tests.len() == 1 { - println!("executing 1 test in {}:", module_name); + println!("executing 1 test in {module_name}:"); } else { println!("executing {} tests in {}:", tests.len(), module_name); } @@ -83,18 +83,18 @@ fn test_ingot(args: &TestArgs) -> TestSink { let optimize = args.optimize.unwrap_or(true); if !Path::new(input_path).exists() { - eprintln!("Input directory does not exist: `{}`.", input_path); + eprintln!("Input directory does not exist: `{input_path}`."); std::process::exit(1) } let content = match load_files_from_dir(input_path) { Ok(files) if files.is_empty() => { - eprintln!("Input directory is not an ingot: `{}`", input_path); + eprintln!("Input directory is not an ingot: `{input_path}`"); std::process::exit(1) } Ok(files) => files, Err(err) => { - eprintln!("Failed to load project files. Error: {}", err); + eprintln!("Failed to load project files. Error: {err}"); std::process::exit(1) } }; @@ -110,7 +110,7 @@ fn test_ingot(args: &TestArgs) -> TestSink { sink } Err(error) => { - eprintln!("Unable to compile {}.", input_path); + eprintln!("Unable to compile {input_path}."); print_diagnostics(&db, &error.0); std::process::exit(1) } diff --git a/crates/test-runner/src/lib.rs b/crates/test-runner/src/lib.rs index ed6a8661f5..c7d423d048 100644 --- a/crates/test-runner/src/lib.rs +++ b/crates/test-runner/src/lib.rs @@ -48,9 +48,9 @@ impl Display for TestSink { let test_description = |n: usize, status: &dyn Display| -> String { if n == 1 { - format!("1 test {}", status) + format!("1 test {status}") } else { - format!("{} tests {}", n, status) + format!("{n} tests {status}") } }; @@ -85,7 +85,7 @@ pub fn execute(name: &str, bytecode: &str, sink: &mut TestSink) -> bool { if reverted { sink.inc_success_count(); } else { - sink.insert_failure(name, &format!("{:?}", result)); + sink.insert_failure(name, &format!("{result:?}")); }; reverted