Skip to content

Commit 136a582

Browse files
Add non_exhaustive checks in derive_partial_eq_without_eq.rs ui test
1 parent a198904 commit 136a582

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

tests/ui/derive_partial_eq_without_eq.fixed

+32
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,36 @@ pub fn _from_mod() -> _hidden::InPubFn {
121121
#[derive(PartialEq)]
122122
struct InternalTy;
123123

124+
// This is a `non_exhaustive` type so should not warn.
125+
#[derive(Debug, PartialEq)]
126+
#[non_exhaustive]
127+
pub struct MissingEqNonExhaustive {
128+
foo: u32,
129+
bar: String,
130+
}
131+
132+
// This is a `non_exhaustive` type so should not warn.
133+
#[derive(Debug, PartialEq)]
134+
pub struct MissingEqNonExhaustive1 {
135+
foo: u32,
136+
#[non_exhaustive]
137+
bar: String,
138+
}
139+
140+
// This is a `non_exhaustive` type so should not warn.
141+
#[derive(Debug, PartialEq)]
142+
#[non_exhaustive]
143+
pub enum MissingEqNonExhaustive2 {
144+
Foo,
145+
Bar,
146+
}
147+
148+
// This is a `non_exhaustive` type so should not warn.
149+
#[derive(Debug, PartialEq)]
150+
pub enum MissingEqNonExhaustive3 {
151+
Foo,
152+
#[non_exhaustive]
153+
Bar,
154+
}
155+
124156
fn main() {}

tests/ui/derive_partial_eq_without_eq.rs

+32
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,36 @@ pub fn _from_mod() -> _hidden::InPubFn {
121121
#[derive(PartialEq)]
122122
struct InternalTy;
123123

124+
// This is a `non_exhaustive` type so should not warn.
125+
#[derive(Debug, PartialEq)]
126+
#[non_exhaustive]
127+
pub struct MissingEqNonExhaustive {
128+
foo: u32,
129+
bar: String,
130+
}
131+
132+
// This is a `non_exhaustive` type so should not warn.
133+
#[derive(Debug, PartialEq)]
134+
pub struct MissingEqNonExhaustive1 {
135+
foo: u32,
136+
#[non_exhaustive]
137+
bar: String,
138+
}
139+
140+
// This is a `non_exhaustive` type so should not warn.
141+
#[derive(Debug, PartialEq)]
142+
#[non_exhaustive]
143+
pub enum MissingEqNonExhaustive2 {
144+
Foo,
145+
Bar,
146+
}
147+
148+
// This is a `non_exhaustive` type so should not warn.
149+
#[derive(Debug, PartialEq)]
150+
pub enum MissingEqNonExhaustive3 {
151+
Foo,
152+
#[non_exhaustive]
153+
Bar,
154+
}
155+
124156
fn main() {}

0 commit comments

Comments
 (0)