1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
10 fn get_number() -> usize {
14 fn get_reference(n: &usize) -> &usize {
18 #[allow(clippy::many_single_char_names, clippy::double_parens)]
19 #[allow(unused_variables)]
20 #[warn(clippy::deref_addrof)]
27 let b = *&get_number();
29 let b = *get_reference(&a);
31 let bytes: Vec<usize> = vec![1, 2, 3, 4];
32 let b = *&bytes[1..2][0];
34 //This produces a suggestion of 'let b = (a);' which
35 //will trigger the 'unused_parens' lint
47 //This produces a suggestion of 'let b = *&a;' which
48 //will trigger the 'clippy::deref_addrof' lint again
57 //This produces a suggestion of 'let y = *&mut x' which
58 //will trigger the 'clippy::deref_addrof' lint again
60 let y = **&mut &mut x;