]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #107679 - est31:less_import_overhead, r=compiler-errors
authorbors <bors@rust-lang.org>
Sun, 5 Feb 2023 11:10:11 +0000 (11:10 +0000)
committerbors <bors@rust-lang.org>
Sun, 5 Feb 2023 11:10:11 +0000 (11:10 +0000)
Less import overhead for errors

This removes huge (3+ lines) import lists found in files that had their error reporting migrated. These lists are bad for developer workflows as adding, removing, or editing a single error's name might cause a chain reaction that bloats the git diff. As the error struct names are long, the likelihood of such chain reactions is high.

Follows the suggestion by `@Nilstrieb` in the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/massive.20use.20statements) to replace the `use errors::{FooErr, BarErr};` with `use errors;` and then changing to `errors::FooErr` on the usage sites.

I have used sed to do most of the changes, i.e. something like:

```
sed -i -E 's/(create_err|create_feature_err|emit_err|create_note|emit_fatal|emit_warning)\(([[:alnum:]]+|[A-Z][[:alnum:]:]*)( \{|\))/\1(errors::\2\3/' path/to/file.rs
```

& then I manually fixed the errors that occured. Most manual changes were required in `compiler/rustc_parse/src/parser/expr.rs`.

r? `@compiler-errors`


Trivial merge