-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #103338 - l4l:enum-unreachable-pub, r=nagisa
Fix unreachable_pub suggestion for enum with fields Resolves #103317
- Loading branch information
Showing
4 changed files
with
51 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,14 @@ | ||
// check-pass | ||
// run-rustfix | ||
|
||
#[warn(unreachable_pub)] | ||
mod inner { | ||
#[allow(unused)] | ||
pub(crate) 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,14 @@ | ||
// check-pass | ||
// run-rustfix | ||
|
||
#[warn(unreachable_pub)] | ||
mod inner { | ||
#[allow(unused)] | ||
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:7: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:4:8 | ||
| | ||
LL | #[warn(unreachable_pub)] | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
warning: 1 warning emitted | ||
|