3 #![feature(box_syntax)]
4 #![feature(box_patterns)]
5 #![warn(unused)] // UI tests pass `-A unused` (#43896)
8 corridors_of_light: usize,
10 endless_and_singing: bool
13 struct LovelyAmbition {
18 #[derive(Clone, Copy)]
23 struct Tuple(Large, ());
26 let i_think_continually = 2; //~ WARNING unused variable: `i_think_continually`
27 let who_from_the_womb_remembered = SoulHistory {
28 corridors_of_light: 5,
30 endless_and_singing: true
33 let mut mut_unused_var = 1;
34 //~^ WARNING unused variable: `mut_unused_var`
35 //~| WARNING variable does not need to be mutable
37 let (mut var, unused_var) = (1, 2);
38 //~^ WARNING unused variable: `var`
39 //~| WARNING unused variable: `unused_var`
40 //~| WARNING variable does not need to be mutable
41 // NOTE: `var` comes after `unused_var` lexicographically yet the warning
42 // for `var` will be emitted before the one for `unused_var`. We use an
43 // `IndexMap` to ensure this is the case instead of a `BTreeMap`.
45 if let SoulHistory { corridors_of_light, //~ WARNING unused variable: `corridors_of_light`
46 mut hours_are_suns, //~ WARNING `hours_are_suns` is assigned to, but
47 endless_and_singing: true } = who_from_the_womb_remembered {
48 hours_are_suns = false; //~ WARNING unused_assignments
51 let the_spirit = LovelyAmbition { lips: 1, fire: 2 };
52 let LovelyAmbition { lips, fire } = the_spirit; //~ WARNING unused variable: `fire`
55 let bag = Large::Suit {
61 Large::Suit { case } => {} //~ WARNING unused variable: `case`
66 &Large::Suit { case } => {} //~ WARNING unused variable: `case`
71 box Large::Suit { case } => {} //~ WARNING unused variable: `case`
76 (Large::Suit { case },) => {} //~ WARNING unused variable: `case`
81 [Large::Suit { case }] => {} //~ WARNING unused variable: `case`
84 // Tuple struct with struct
85 match Tuple(bag, ()) {
86 Tuple(Large::Suit { case }, ()) => {} //~ WARNING unused variable: `case`