]> git.lizzy.rs Git - rust.git/blob - tests/ui/mut_mut.rs
Adapt the *.stderr files of the ui-tests to the tool_lints
[rust.git] / tests / ui / mut_mut.rs
1 #![feature(tool_lints)]
2
3
4 #![allow(unused, clippy::no_effect, clippy::unnecessary_operation)]
5 #![warn(clippy::mut_mut)]
6
7
8
9
10 fn fun(x : &mut &mut u32) -> bool {
11     **x > 0
12 }
13
14 fn less_fun(x : *mut *mut u32) {
15   let y = x;
16 }
17
18 macro_rules! mut_ptr {
19     ($p:expr) => { &mut $p }
20 }
21
22 #[allow(unused_mut, unused_variables)]
23 fn main() {
24     let mut x = &mut &mut 1u32;
25     {
26         let mut y = &mut x;
27     }
28
29     if fun(x) {
30         let y : &mut &mut u32 = &mut &mut 2;
31         **y + **x;
32     }
33
34     if fun(x) {
35         let y : &mut &mut &mut u32 = &mut &mut &mut 2;
36         ***y + **x;
37     }
38
39     let mut z = mut_ptr!(&mut 3u32);
40 }
41
42 fn issue939() {
43     let array = [5, 6, 7, 8, 9];
44     let mut args = array.iter().skip(2);
45     for &arg in &mut args {
46         println!("{}", arg);
47     }
48
49     let args = &mut args;
50     for arg in args {
51         println!(":{}", arg);
52     }
53 }