1
Fork 0

Improve code readability by moving fmt args directly into the string

This commit is contained in:
Guillaume Gomez 2023-08-14 22:25:32 +02:00
parent 3071e0aef6
commit a1a94b1c0f
35 changed files with 261 additions and 300 deletions

View file

@ -107,7 +107,7 @@ fn check_rust_syntax(
// just give a `help` instead.
lint.span_help(
sp.from_inner(InnerSpan::new(0, 3)),
format!("{}: ```text", explanation),
format!("{explanation}: ```text"),
);
} else if empty_block {
lint.span_suggestion(
@ -118,7 +118,7 @@ fn check_rust_syntax(
);
}
} else if empty_block || is_ignore {
lint.help(format!("{}: ```text", explanation));
lint.help(format!("{explanation}: ```text"));
}
// FIXME(#67563): Provide more context for these errors by displaying the spans inline.
@ -160,7 +160,7 @@ impl Emitter for BufferEmitter {
.translate_message(&diag.message[0].0, &fluent_args)
.unwrap_or_else(|e| panic!("{e}"));
buffer.messages.push(format!("error from rustc: {}", translated_main_message));
buffer.messages.push(format!("error from rustc: {translated_main_message}"));
if diag.is_error() {
buffer.has_errors = true;
}