Use chaining for DiagnosticBuilder
construction and emit
.
To avoid the use of a mutable local variable, and because it reads more nicely.
This commit is contained in:
parent
589591efde
commit
bd4e623485
22 changed files with 193 additions and 183 deletions
|
@ -693,13 +693,14 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
|
|||
0 => {}
|
||||
1 => {
|
||||
let (sp, msg) = unused_operands.into_iter().next().unwrap();
|
||||
let mut err = ecx.dcx().struct_span_err(sp, msg);
|
||||
err.span_label(sp, msg);
|
||||
err.help(format!(
|
||||
"if this argument is intentionally unused, \
|
||||
consider using it in an asm comment: `\"/*{help_str} */\"`"
|
||||
));
|
||||
err.emit();
|
||||
ecx.dcx()
|
||||
.struct_span_err(sp, msg)
|
||||
.span_label_mv(sp, msg)
|
||||
.help_mv(format!(
|
||||
"if this argument is intentionally unused, \
|
||||
consider using it in an asm comment: `\"/*{help_str} */\"`"
|
||||
))
|
||||
.emit();
|
||||
}
|
||||
_ => {
|
||||
let mut err = ecx.dcx().struct_span_err(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue