1
Fork 0

inline format!() args up to and including rustc_middle

This commit is contained in:
Matthias Krüger 2023-07-25 22:00:13 +02:00
parent 2e0136a131
commit 23815467a2
87 changed files with 378 additions and 437 deletions

View file

@ -575,7 +575,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
|| named_pos.contains_key(&idx)
|| args.reg_args.contains(idx)
{
let msg = format!("invalid reference to argument at index {}", idx);
let msg = format!("invalid reference to argument at index {idx}");
let mut err = ecx.struct_span_err(span, msg);
err.span_label(span, "from here");
@ -588,9 +588,9 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
""
};
let msg = match positional_args {
0 => format!("no {}arguments were given", positional),
1 => format!("there is 1 {}argument", positional),
x => format!("there are {} {}arguments", x, positional),
0 => format!("no {positional}arguments were given"),
1 => format!("there is 1 {positional}argument"),
x => format!("there are {x} {positional}arguments"),
};
err.note(msg);
@ -624,7 +624,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
match args.named_args.get(&Symbol::intern(name)) {
Some(&idx) => Some(idx),
None => {
let msg = format!("there is no argument named `{}`", name);
let msg = format!("there is no argument named `{name}`");
let span = arg.position_span;
ecx.struct_span_err(
template_span
@ -697,8 +697,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
err.span_label(sp, msg);
err.help(format!(
"if this argument is intentionally unused, \
consider using it in an asm comment: `\"/*{} */\"`",
help_str
consider using it in an asm comment: `\"/*{help_str} */\"`"
));
err.emit();
}
@ -712,8 +711,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
}
err.help(format!(
"if these arguments are intentionally unused, \
consider using them in an asm comment: `\"/*{} */\"`",
help_str
consider using them in an asm comment: `\"/*{help_str} */\"`"
));
err.emit();
}