Skip to content

Commit 67ea821

Browse files
committed
style: Use inline format args
1 parent 9599e01 commit 67ea821

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/renderer/display_list.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl<'a> DisplaySet<'a> {
198198
self.format_label(line_offset, &annotation.label, stylesheet, buffer)
199199
} else {
200200
let id = match &annotation.id {
201-
Some(id) => format!("[{}]", id),
201+
Some(id) => format!("[{id}]"),
202202
None => String::new(),
203203
};
204204
buffer.append(
@@ -290,12 +290,12 @@ impl<'a> DisplaySet<'a> {
290290
} => {
291291
let lineno_color = stylesheet.line_no();
292292
if anonymized_line_numbers && lineno.is_some() {
293-
let num = format!("{:>width$} |", ANONYMIZED_LINE_NUM, width = lineno_width);
293+
let num = format!("{ANONYMIZED_LINE_NUM:>lineno_width$} |");
294294
buffer.puts(line_offset, 0, &num, *lineno_color);
295295
} else {
296296
match lineno {
297297
Some(n) => {
298-
let num = format!("{:>width$} |", n, width = lineno_width);
298+
let num = format!("{n:>lineno_width$} |");
299299
buffer.puts(line_offset, 0, &num, *lineno_color);
300300
}
301301
None => {
@@ -645,7 +645,7 @@ impl<'a> DisplaySet<'a> {
645645
} else if formatted_len != 0 {
646646
formatted_len += 2;
647647
let id = match &annotation.annotation.id {
648-
Some(id) => format!("[{}]", id),
648+
Some(id) => format!("[{id}]"),
649649
None => String::new(),
650650
};
651651
buffer.puts(
@@ -1292,10 +1292,7 @@ fn format_body(
12921292
None
12931293
}
12941294
}) {
1295-
panic!(
1296-
"SourceAnnotation range `{:?}` is beyond the end of buffer `{}`",
1297-
bigger, source_len
1298-
)
1295+
panic!("SourceAnnotation range `{bigger:?}` is beyond the end of buffer `{source_len}`")
12991296
}
13001297

13011298
let mut body = vec![];

tests/fixtures/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn setup(input_path: std::path::PathBuf) -> tryfn::Case {
2222
.to_str()
2323
.unwrap();
2424
let file_name = input_path.file_name().unwrap().to_str().unwrap();
25-
let name = format!("{}/{}", parent, file_name);
25+
let name = format!("{parent}/{file_name}");
2626
let expected = Data::read_from(&input_path.with_extension("svg"), None);
2727
tryfn::Case {
2828
name,

0 commit comments

Comments
 (0)