2022-05-05 09:12:52 -05:00
|
|
|
#![warn(clippy::manual_non_exhaustive)]
|
|
|
|
#![allow(unused)]
|
2023-08-24 14:32:12 -05:00
|
|
|
//@no-rustfix
|
2024-09-04 16:22:28 -05:00
|
|
|
pub enum E {
|
|
|
|
//~^ manual_non_exhaustive
|
2022-05-05 09:12:52 -05:00
|
|
|
A,
|
|
|
|
B,
|
|
|
|
#[doc(hidden)]
|
|
|
|
_C,
|
|
|
|
}
|
|
|
|
|
2023-10-06 10:35:45 -05:00
|
|
|
// if the user explicitly marks as nonexhaustive we shouldn't warn them
|
2022-05-05 09:12:52 -05:00
|
|
|
#[non_exhaustive]
|
2024-09-04 16:22:28 -05:00
|
|
|
pub enum Ep {
|
2022-05-05 09:12:52 -05:00
|
|
|
A,
|
|
|
|
B,
|
|
|
|
#[doc(hidden)]
|
|
|
|
_C,
|
|
|
|
}
|
|
|
|
|
|
|
|
// marker variant does not have doc hidden attribute, should be ignored
|
2024-09-04 16:22:28 -05:00
|
|
|
pub enum NoDocHidden {
|
2022-05-05 09:12:52 -05:00
|
|
|
A,
|
|
|
|
B,
|
|
|
|
_C,
|
|
|
|
}
|
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
// name of variant with doc hidden does not start with underscore
|
2024-09-04 16:22:28 -05:00
|
|
|
pub enum NoUnderscore {
|
2022-05-05 09:12:52 -05:00
|
|
|
A,
|
|
|
|
B,
|
|
|
|
#[doc(hidden)]
|
|
|
|
C,
|
|
|
|
}
|
|
|
|
|
|
|
|
// variant with doc hidden is not unit, should be ignored
|
2024-09-04 16:22:28 -05:00
|
|
|
pub enum NotUnit {
|
2022-05-05 09:12:52 -05:00
|
|
|
A,
|
|
|
|
B,
|
|
|
|
#[doc(hidden)]
|
|
|
|
_C(bool),
|
|
|
|
}
|
|
|
|
|
|
|
|
// variant with doc hidden is the only one, should be ignored
|
2024-09-04 16:22:28 -05:00
|
|
|
pub enum OnlyMarker {
|
2022-05-05 09:12:52 -05:00
|
|
|
#[doc(hidden)]
|
|
|
|
_A,
|
|
|
|
}
|
|
|
|
|
|
|
|
// variant with multiple markers, should be ignored
|
2024-09-04 16:22:28 -05:00
|
|
|
pub enum MultipleMarkers {
|
2022-05-05 09:12:52 -05:00
|
|
|
A,
|
|
|
|
#[doc(hidden)]
|
|
|
|
_B,
|
|
|
|
#[doc(hidden)]
|
|
|
|
_C,
|
|
|
|
}
|
|
|
|
|
|
|
|
// already non_exhaustive and no markers, should be ignored
|
|
|
|
#[non_exhaustive]
|
2024-09-04 16:22:28 -05:00
|
|
|
pub enum NonExhaustive {
|
2022-05-05 09:12:52 -05:00
|
|
|
A,
|
|
|
|
B,
|
|
|
|
}
|
|
|
|
|
|
|
|
// marked is used, don't lint
|
2024-09-04 16:22:28 -05:00
|
|
|
pub enum UsedHidden {
|
2022-05-05 09:12:52 -05:00
|
|
|
#[doc(hidden)]
|
|
|
|
_A,
|
|
|
|
B,
|
|
|
|
C,
|
|
|
|
}
|
|
|
|
fn foo(x: &mut UsedHidden) {
|
|
|
|
if matches!(*x, UsedHidden::B) {
|
|
|
|
*x = UsedHidden::_A;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
#[expect(clippy::manual_non_exhaustive)]
|
2024-09-04 16:22:28 -05:00
|
|
|
pub enum ExpectLint {
|
2022-06-30 03:50:09 -05:00
|
|
|
A,
|
|
|
|
B,
|
|
|
|
#[doc(hidden)]
|
|
|
|
_C,
|
|
|
|
}
|