Shorten some error invocations.

- `struct_foo` + `emit` -> `foo`
- `create_foo` + `emit` -> `emit_foo`

I have made recent commits in other PRs that have removed some of these
shortcuts for combinations with few uses, e.g.
`struct_span_err_with_code`. But for the remaining combinations that
have high levels of use, we might as well use them wherever possible.
This commit is contained in:
Nicholas Nethercote
2024-01-04 10:38:10 +11:00
parent 4864cb8aef
commit ff40ad4107
13 changed files with 30 additions and 34 deletions

View File

@@ -2301,7 +2301,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
let report_error = |this: &Self, ns| {
if this.should_report_errs() {
let what = if ns == TypeNS { "type parameters" } else { "local variables" };
this.r.dcx().create_err(ImportsCannotReferTo { span: ident.span, what }).emit();
this.r.dcx().emit_err(ImportsCannotReferTo { span: ident.span, what });
}
};