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
|
@ -303,14 +303,14 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
// This exception needs to be kept in sync with allowing
|
||||
// `#[target_feature]` on `main` and `start`.
|
||||
} else if !tcx.features().target_feature_11 {
|
||||
let mut err = feature_err(
|
||||
feature_err(
|
||||
&tcx.sess.parse_sess,
|
||||
sym::target_feature_11,
|
||||
attr.span,
|
||||
"`#[target_feature(..)]` can only be applied to `unsafe` functions",
|
||||
);
|
||||
err.span_label(tcx.def_span(did), "not an `unsafe` function");
|
||||
err.emit();
|
||||
)
|
||||
.span_label_mv(tcx.def_span(did), "not an `unsafe` function")
|
||||
.emit();
|
||||
} else {
|
||||
check_target_feature_trait_unsafe(tcx, did, attr.span);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue