1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-01 19:02:22 +01:00

Inline format! args wherever possible

This commit is contained in:
Lena
2024-02-24 22:36:14 +01:00
committed by Martin Nordholts
parent 487bed2d95
commit 4c85483486
17 changed files with 35 additions and 40 deletions

View File

@@ -1758,7 +1758,7 @@ fn do_not_panic_regression_tests() {
] {
bat()
.arg("--color=always")
.arg(&format!("regression_tests/{}", filename))
.arg(&format!("regression_tests/{filename}"))
.assert()
.success();
}
@@ -1771,7 +1771,7 @@ fn do_not_detect_different_syntax_for_stdin_and_files() {
let cmd_for_file = bat()
.arg("--color=always")
.arg("--map-syntax=*.js:Markdown")
.arg(&format!("--file-name={}", file))
.arg(&format!("--file-name={file}"))
.arg("--style=plain")
.arg(file)
.assert()
@@ -1781,7 +1781,7 @@ fn do_not_detect_different_syntax_for_stdin_and_files() {
.arg("--color=always")
.arg("--map-syntax=*.js:Markdown")
.arg("--style=plain")
.arg(&format!("--file-name={}", file))
.arg(&format!("--file-name={file}"))
.pipe_stdin(Path::new(EXAMPLES_DIR).join(file))
.unwrap()
.assert()
@@ -1800,7 +1800,7 @@ fn no_first_line_fallback_when_mapping_to_invalid_syntax() {
bat()
.arg("--color=always")
.arg("--map-syntax=*.invalid-syntax:InvalidSyntax")
.arg(&format!("--file-name={}", file))
.arg(&format!("--file-name={file}"))
.arg("--style=plain")
.arg(file)
.assert()
@@ -1998,7 +1998,7 @@ fn ansi_passthrough_emit() {
.arg("--paging=never")
.arg("--color=never")
.arg("--terminal-width=80")
.arg(format!("--wrap={}", wrapping))
.arg(format!("--wrap={wrapping}"))
.arg("--decorations=always")
.arg("--style=plain")
.write_stdin("\x1B[33mColor\nColor \x1B[m\nPlain\n")

View File

@@ -30,8 +30,7 @@ fn no_duplicate_extensions() {
for extension in &syntax.file_extensions {
assert!(
KNOWN_EXCEPTIONS.contains(&extension.as_str()) || extensions.insert(extension),
"File extension / pattern \"{}\" appears twice in the syntax set",
extension
"File extension / pattern \"{extension}\" appears twice in the syntax set"
);
}
}

View File

@@ -29,7 +29,7 @@ impl BatTester {
"--color=never",
"--decorations=always",
"--terminal-width=80",
&format!("--style={}", style),
&format!("--style={style}"),
])
.output()
.expect("bat failed");
@@ -40,7 +40,7 @@ impl BatTester {
.replace("tests/snapshots/", "");
let mut expected = String::new();
let mut file = File::open(format!("tests/snapshots/output/{}.snapshot.txt", name))
let mut file = File::open(format!("tests/snapshots/output/{name}.snapshot.txt"))
.expect("snapshot file missing");
file.read_to_string(&mut expected)
.expect("could not read snapshot file");