]> git.lizzy.rs Git - rust.git/blob - tests/ui/deref_addrof.fixed
iterate List by value
[rust.git] / tests / ui / deref_addrof.fixed
1 // run-rustfix
2
3 fn get_number() -> usize {
4     10
5 }
6
7 fn get_reference(n: &usize) -> &usize {
8     n
9 }
10
11 #[allow(clippy::many_single_char_names, clippy::double_parens)]
12 #[allow(unused_variables, unused_parens)]
13 #[warn(clippy::deref_addrof)]
14 fn main() {
15     let a = 10;
16     let aref = &a;
17
18     let b = a;
19
20     let b = get_number();
21
22     let b = *get_reference(&a);
23
24     let bytes: Vec<usize> = vec![1, 2, 3, 4];
25     let b = bytes[1..2][0];
26
27     //This produces a suggestion of 'let b = (a);' which
28     //will trigger the 'unused_parens' lint
29     let b = (a);
30
31     let b = a;
32
33     #[rustfmt::skip]
34     let b = a;
35
36     let b = &a;
37
38     let b = *aref;
39 }