Correct unused field warning on struct match container patterns
This commit is contained in:
@@ -20,10 +20,13 @@ struct SoulHistory {
|
||||
endless_and_singing: bool
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
enum Large {
|
||||
Suit { case: () }
|
||||
}
|
||||
|
||||
struct Tuple(Large, ());
|
||||
|
||||
fn main() {
|
||||
let i_think_continually = 2;
|
||||
let who_from_the_womb_remembered = SoulHistory {
|
||||
@@ -42,11 +45,33 @@ fn main() {
|
||||
case: ()
|
||||
};
|
||||
|
||||
// Plain struct
|
||||
match bag {
|
||||
Large::Suit { case } => {}
|
||||
};
|
||||
|
||||
// Referenced struct
|
||||
match &bag {
|
||||
&Large::Suit { case } => {}
|
||||
};
|
||||
|
||||
// Boxed struct
|
||||
match box bag {
|
||||
box Large::Suit { case } => {}
|
||||
};
|
||||
|
||||
// Tuple with struct
|
||||
match (bag,) {
|
||||
(Large::Suit { case },) => {}
|
||||
};
|
||||
|
||||
// Slice with struct
|
||||
match [bag] {
|
||||
[Large::Suit { case }] => {}
|
||||
};
|
||||
|
||||
// Tuple struct with struct
|
||||
match Tuple(bag, ()) {
|
||||
Tuple(Large::Suit { case }, ()) => {}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user