1
Fork 0

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

@ -1371,12 +1371,12 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let ImportKind::Glob { id, is_prelude, .. } = import.kind else { unreachable!() };
let ModuleOrUniformRoot::Module(module) = import.imported_module.get().unwrap() else {
self.dcx().create_err(CannotGlobImportAllCrates { span: import.span }).emit();
self.dcx().emit_err(CannotGlobImportAllCrates { span: import.span });
return;
};
if module.is_trait() {
self.dcx().create_err(ItemsInTraitsAreNotImportable { span: import.span }).emit();
self.dcx().emit_err(ItemsInTraitsAreNotImportable { span: import.span });
return;
} else if module == import.parent_scope.module {
return;