Skip to content

Commit

Permalink
Make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
cburgdorf committed Mar 29, 2023
1 parent 2ede8a3 commit e7af7d2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/analyzer/src/traversal/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![],
);
Expand Down
16 changes: 8 additions & 8 deletions crates/fe/src/task/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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,
Expand All @@ -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)
}
Expand All @@ -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);
}
Expand All @@ -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)
}
};
Expand All @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions crates/test-runner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
}
};

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e7af7d2

Please sign in to comment.