]> git.lizzy.rs Git - rust.git/blob - tests/ui/shadow.rs
Merge pull request #1520 from Manishearth/rustup
[rust.git] / tests / ui / shadow.rs
1 #![feature(plugin)]
2 #![plugin(clippy)]
3
4 #![deny(clippy, clippy_pedantic)]
5 #![allow(unused_parens, unused_variables, missing_docs_in_private_items)]
6
7 fn id<T>(x: T) -> T { x }
8
9 fn first(x: (isize, isize)) -> isize { x.0 }
10
11 fn main() {
12     let mut x = 1;
13     let x = &mut x;
14     let x = { x };
15     let x = (&*x);
16     let x = { *x + 1 };
17     let x = id(x);
18     let x = (1, x);
19     let x = first(x);
20     let y = 1;
21     let x = y;
22
23     let x;
24     x = 42;
25
26     let o = Some(1_u8);
27
28     if let Some(p) = o { assert_eq!(1, p); }
29     match o {
30         Some(p) => p, // no error, because the p above is in its own scope
31         None => 0,
32     };
33
34     match (x, o) {
35         (1, Some(a)) | (a, Some(1)) => (), // no error though `a` appears twice
36         _ => (),
37     }
38 }