diff options
Diffstat (limited to 'src/tools/clippy/src/docs/wildcard_imports.txt')
-rw-r--r-- | src/tools/clippy/src/docs/wildcard_imports.txt | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/tools/clippy/src/docs/wildcard_imports.txt b/src/tools/clippy/src/docs/wildcard_imports.txt deleted file mode 100644 index bd56aa5b0..000000000 --- a/src/tools/clippy/src/docs/wildcard_imports.txt +++ /dev/null @@ -1,45 +0,0 @@ -### What it does -Checks for wildcard imports `use _::*`. - -### Why is this bad? -wildcard imports can pollute the namespace. This is especially bad if -you try to import something through a wildcard, that already has been imported by name from -a different source: - -``` -use crate1::foo; // Imports a function named foo -use crate2::*; // Has a function named foo - -foo(); // Calls crate1::foo -``` - -This can lead to confusing error messages at best and to unexpected behavior at worst. - -### Exceptions -Wildcard imports are allowed from modules named `prelude`. Many crates (including the standard library) -provide modules named "prelude" specifically designed for wildcard import. - -`use super::*` is allowed in test modules. This is defined as any module with "test" in the name. - -These exceptions can be disabled using the `warn-on-all-wildcard-imports` configuration flag. - -### Known problems -If macros are imported through the wildcard, this macro is not included -by the suggestion and has to be added by hand. - -Applying the suggestion when explicit imports of the things imported with a glob import -exist, may result in `unused_imports` warnings. - -### Example -``` -use crate1::*; - -foo(); -``` - -Use instead: -``` -use crate1::foo; - -foo(); -```
\ No newline at end of file |