-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move enum_glob_use lint into wildcard_imports pass
- Loading branch information
Showing
6 changed files
with
91 additions
and
78 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// run-rustfix | ||
|
||
#![warn(clippy::enum_glob_use)] | ||
#![allow(unused)] | ||
#![warn(unused_imports)] | ||
|
||
use std::cmp::Ordering::Less; | ||
|
||
enum Enum { | ||
Foo, | ||
} | ||
|
||
use self::Enum::Foo; | ||
|
||
mod in_fn_test { | ||
fn blarg() { | ||
use crate::Enum::Foo; | ||
|
||
let _ = Foo; | ||
} | ||
} | ||
|
||
mod blurg { | ||
pub use std::cmp::Ordering::*; // ok, re-export | ||
} | ||
|
||
fn main() { | ||
let _ = Foo; | ||
let _ = Less; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
#![warn(clippy::all, clippy::pedantic)] | ||
#![allow(unused_imports, dead_code, clippy::missing_docs_in_private_items)] | ||
// run-rustfix | ||
|
||
#![warn(clippy::enum_glob_use)] | ||
#![allow(unused)] | ||
#![warn(unused_imports)] | ||
|
||
use std::cmp::Ordering::*; | ||
|
||
enum Enum { | ||
_Foo, | ||
Foo, | ||
} | ||
|
||
use self::Enum::*; | ||
|
||
fn blarg() { | ||
use self::Enum::*; // ok, just for a function | ||
mod in_fn_test { | ||
fn blarg() { | ||
use crate::Enum::*; | ||
|
||
let _ = Foo; | ||
} | ||
} | ||
|
||
mod blurg { | ||
pub use std::cmp::Ordering::*; // ok, re-export | ||
} | ||
|
||
mod tests { | ||
use super::*; | ||
fn main() { | ||
let _ = Foo; | ||
let _ = Less; | ||
} | ||
|
||
#[allow(non_snake_case)] | ||
mod CamelCaseName {} | ||
|
||
use CamelCaseName::*; | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
error: don't use glob imports for enum variants | ||
--> $DIR/enum_glob_use.rs:4:1 | ||
error: usage of wildcard import for enum variants | ||
--> $DIR/enum_glob_use.rs:7:5 | ||
| | ||
LL | use std::cmp::Ordering::*; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::cmp::Ordering::Less` | ||
| | ||
= note: `-D clippy::enum-glob-use` implied by `-D warnings` | ||
|
||
error: don't use glob imports for enum variants | ||
--> $DIR/enum_glob_use.rs:10:1 | ||
error: usage of wildcard import for enum variants | ||
--> $DIR/enum_glob_use.rs:13:5 | ||
| | ||
LL | use self::Enum::*; | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| ^^^^^^^^^^^^^ help: try: `self::Enum::Foo` | ||
|
||
error: aborting due to 2 previous errors | ||
error: usage of wildcard import for enum variants | ||
--> $DIR/enum_glob_use.rs:17:13 | ||
| | ||
LL | use crate::Enum::*; | ||
| ^^^^^^^^^^^^^^ help: try: `crate::Enum::Foo` | ||
|
||
error: aborting due to 3 previous errors | ||
|