-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unreachable_pub suggestion for enum with fields
- Loading branch information
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
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,13 @@ | ||
// check-pass | ||
|
||
#[warn(unreachable_pub)] | ||
#[allow(unused)] | ||
mod inner { | ||
pub enum T { | ||
//~^ WARN unreachable `pub` item | ||
A(u8), | ||
X { a: f32, b: () }, | ||
} | ||
} | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
warning: unreachable `pub` item | ||
--> $DIR/issue-103317.rs:6:5 | ||
| | ||
LL | pub enum T { | ||
| ---^^^^^^^ | ||
| | | ||
| help: consider restricting its visibility: `pub(crate)` | ||
| | ||
= help: or consider exporting it for use by other crates | ||
note: the lint level is defined here | ||
--> $DIR/issue-103317.rs:3:8 | ||
| | ||
LL | #[warn(unreachable_pub)] | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
warning: 1 warning emitted | ||
|