1 error: this expression creates a reference which is immediately dereferenced by the compiler
2 --> $DIR/needless_borrow.rs:11:15
4 LL | let _ = x(&&a); // warn
5 | ^^^ help: change this to: `&a`
7 = note: `-D clippy::needless-borrow` implied by `-D warnings`
9 error: this expression creates a reference which is immediately dereferenced by the compiler
10 --> $DIR/needless_borrow.rs:15:13
12 LL | mut_ref(&mut &mut b); // warn
13 | ^^^^^^^^^^^ help: change this to: `&mut b`
15 error: this expression creates a reference which is immediately dereferenced by the compiler
16 --> $DIR/needless_borrow.rs:27:13
19 | ^^^ help: change this to: `&a`
21 error: this expression creates a reference which is immediately dereferenced by the compiler
22 --> $DIR/needless_borrow.rs:29:15
25 | ^^^ help: change this to: `&a`
27 error: this expression creates a reference which is immediately dereferenced by the compiler
28 --> $DIR/needless_borrow.rs:35:27
31 | ^^^^^^ help: change this to: `ref_a`
33 error: this expression creates a reference which is immediately dereferenced by the compiler
34 --> $DIR/needless_borrow.rs:42:15
37 | ^^^^ help: change this to: `&a`
39 error: this expression creates a reference which is immediately dereferenced by the compiler
40 --> $DIR/needless_borrow.rs:43:15
42 LL | let _ = x(&mut &&a);
43 | ^^^^^^^^ help: change this to: `&a`
45 error: this expression creates a reference which is immediately dereferenced by the compiler
46 --> $DIR/needless_borrow.rs:44:15
48 LL | let _ = x(&&&mut b);
49 | ^^^^^^^^ help: change this to: `&mut b`
51 error: this expression creates a reference which is immediately dereferenced by the compiler
52 --> $DIR/needless_borrow.rs:45:15
54 LL | let _ = x(&&ref_a);
55 | ^^^^^^^ help: change this to: `ref_a`
57 error: this expression creates a reference which is immediately dereferenced by the compiler
58 --> $DIR/needless_borrow.rs:48:11
61 | ^^ help: change this to: `b`
63 error: this expression creates a reference which is immediately dereferenced by the compiler
64 --> $DIR/needless_borrow.rs:55:13
67 | ^^^^^^ help: change this to: `x`
69 error: this expression creates a reference which is immediately dereferenced by the compiler
70 --> $DIR/needless_borrow.rs:56:13
72 LL | mut_ref(&mut &mut x);
73 | ^^^^^^^^^^^ help: change this to: `x`
75 error: this expression creates a reference which is immediately dereferenced by the compiler
76 --> $DIR/needless_borrow.rs:57:23
78 LL | let y: &mut i32 = &mut x;
79 | ^^^^^^ help: change this to: `x`
81 error: this expression creates a reference which is immediately dereferenced by the compiler
82 --> $DIR/needless_borrow.rs:58:23
84 LL | let y: &mut i32 = &mut &mut x;
85 | ^^^^^^^^^^^ help: change this to: `x`
87 error: this expression creates a reference which is immediately dereferenced by the compiler
88 --> $DIR/needless_borrow.rs:67:14
91 | ^^^^^^ help: change this to: `x`
93 error: this expression creates a reference which is immediately dereferenced by the compiler
94 --> $DIR/needless_borrow.rs:73:14
97 | ^^^^^^ help: change this to: `x`
99 error: this expression borrows a value the compiler would automatically borrow
100 --> $DIR/needless_borrow.rs:85:13
103 | ^^^^ help: change this to: `x`
105 error: this expression borrows a value the compiler would automatically borrow
106 --> $DIR/needless_borrow.rs:87:22
108 LL | let _ = unsafe { (&*x).0 };
109 | ^^^^^ help: change this to: `(*x)`
111 error: this expression creates a reference which is immediately dereferenced by the compiler
112 --> $DIR/needless_borrow.rs:97:5
115 | ^^^^^^ help: change this to: `(&())`
117 error: this expression creates a reference which is immediately dereferenced by the compiler
118 --> $DIR/needless_borrow.rs:106:5
121 | ^^^^^ help: change this to: `(&5)`
123 error: the borrowed expression implements the required traits
124 --> $DIR/needless_borrow.rs:131:51
126 LL | let _ = std::process::Command::new("ls").args(&["-a", "-l"]).status().unwrap();
127 | ^^^^^^^^^^^^^ help: change this to: `["-a", "-l"]`
129 error: the borrowed expression implements the required traits
130 --> $DIR/needless_borrow.rs:132:44
132 LL | let _ = std::path::Path::new(".").join(&&".");
133 | ^^^^^ help: change this to: `"."`
135 error: the borrowed expression implements the required traits
136 --> $DIR/needless_borrow.rs:133:23
138 LL | deref_target_is_x(&X);
139 | ^^ help: change this to: `X`
141 error: the borrowed expression implements the required traits
142 --> $DIR/needless_borrow.rs:134:26
144 LL | multiple_constraints(&[[""]]);
145 | ^^^^^^^ help: change this to: `[[""]]`
147 error: the borrowed expression implements the required traits
148 --> $DIR/needless_borrow.rs:135:45
150 LL | multiple_constraints_normalizes_to_same(&X, X);
151 | ^^ help: change this to: `X`
153 error: this expression creates a reference which is immediately dereferenced by the compiler
154 --> $DIR/needless_borrow.rs:136:32
156 LL | let _ = Some("").unwrap_or(&"");
157 | ^^^ help: change this to: `""`
159 error: this expression borrows a value the compiler would automatically borrow
160 --> $DIR/needless_borrow.rs:187:13
163 | ^^^^^^^^^ help: change this to: `(self.f)`
165 error: this expression borrows a value the compiler would automatically borrow
166 --> $DIR/needless_borrow.rs:196:13
169 | ^^^^^^^^^^^^^ help: change this to: `(self.f)`
171 error: the borrowed expression implements the required traits
172 --> $DIR/needless_borrow.rs:298:55
174 LL | let _ = std::process::Command::new("ls").args(&["-a", "-l"]).status().unwrap();
175 | ^^^^^^^^^^^^^ help: change this to: `["-a", "-l"]`
177 error: aborting due to 29 previous errors