]> git.lizzy.rs Git - rust.git/blob - tests/ui/needless_borrow.stderr
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / needless_borrow.stderr
1 error: this expression creates a reference which is immediately dereferenced by the compiler
2   --> $DIR/needless_borrow.rs:15:15
3    |
4 LL |     let _ = x(&&a); // warn
5    |               ^^^ help: change this to: `&a`
6    |
7    = note: `-D clippy::needless-borrow` implied by `-D warnings`
8
9 error: this expression creates a reference which is immediately dereferenced by the compiler
10   --> $DIR/needless_borrow.rs:19:13
11    |
12 LL |     mut_ref(&mut &mut b); // warn
13    |             ^^^^^^^^^^^ help: change this to: `&mut b`
14
15 error: this expression creates a reference which is immediately dereferenced by the compiler
16   --> $DIR/needless_borrow.rs:31:13
17    |
18 LL |             &&a
19    |             ^^^ help: change this to: `&a`
20
21 error: this expression creates a reference which is immediately dereferenced by the compiler
22   --> $DIR/needless_borrow.rs:33:15
23    |
24 LL |         46 => &&a,
25    |               ^^^ help: change this to: `&a`
26
27 error: this expression creates a reference which is immediately dereferenced by the compiler
28   --> $DIR/needless_borrow.rs:39:27
29    |
30 LL |                     break &ref_a;
31    |                           ^^^^^^ help: change this to: `ref_a`
32
33 error: this expression creates a reference which is immediately dereferenced by the compiler
34   --> $DIR/needless_borrow.rs:46:15
35    |
36 LL |     let _ = x(&&&a);
37    |               ^^^^ help: change this to: `&a`
38
39 error: this expression creates a reference which is immediately dereferenced by the compiler
40   --> $DIR/needless_borrow.rs:47:15
41    |
42 LL |     let _ = x(&mut &&a);
43    |               ^^^^^^^^ help: change this to: `&a`
44
45 error: this expression creates a reference which is immediately dereferenced by the compiler
46   --> $DIR/needless_borrow.rs:48:15
47    |
48 LL |     let _ = x(&&&mut b);
49    |               ^^^^^^^^ help: change this to: `&mut b`
50
51 error: this expression creates a reference which is immediately dereferenced by the compiler
52   --> $DIR/needless_borrow.rs:49:15
53    |
54 LL |     let _ = x(&&ref_a);
55    |               ^^^^^^^ help: change this to: `ref_a`
56
57 error: this expression creates a reference which is immediately dereferenced by the compiler
58   --> $DIR/needless_borrow.rs:52:11
59    |
60 LL |         x(&b);
61    |           ^^ help: change this to: `b`
62
63 error: this expression creates a reference which is immediately dereferenced by the compiler
64   --> $DIR/needless_borrow.rs:59:13
65    |
66 LL |     mut_ref(&mut x);
67    |             ^^^^^^ help: change this to: `x`
68
69 error: this expression creates a reference which is immediately dereferenced by the compiler
70   --> $DIR/needless_borrow.rs:60:13
71    |
72 LL |     mut_ref(&mut &mut x);
73    |             ^^^^^^^^^^^ help: change this to: `x`
74
75 error: this expression creates a reference which is immediately dereferenced by the compiler
76   --> $DIR/needless_borrow.rs:61:23
77    |
78 LL |     let y: &mut i32 = &mut x;
79    |                       ^^^^^^ help: change this to: `x`
80
81 error: this expression creates a reference which is immediately dereferenced by the compiler
82   --> $DIR/needless_borrow.rs:62:23
83    |
84 LL |     let y: &mut i32 = &mut &mut x;
85    |                       ^^^^^^^^^^^ help: change this to: `x`
86
87 error: this expression creates a reference which is immediately dereferenced by the compiler
88   --> $DIR/needless_borrow.rs:71:14
89    |
90 LL |         0 => &mut x,
91    |              ^^^^^^ help: change this to: `x`
92
93 error: this expression creates a reference which is immediately dereferenced by the compiler
94   --> $DIR/needless_borrow.rs:77:14
95    |
96 LL |         0 => &mut x,
97    |              ^^^^^^ help: change this to: `x`
98
99 error: this expression borrows a value the compiler would automatically borrow
100   --> $DIR/needless_borrow.rs:89:13
101    |
102 LL |     let _ = (&x).0;
103    |             ^^^^ help: change this to: `x`
104
105 error: this expression borrows a value the compiler would automatically borrow
106   --> $DIR/needless_borrow.rs:91:22
107    |
108 LL |     let _ = unsafe { (&*x).0 };
109    |                      ^^^^^ help: change this to: `(*x)`
110
111 error: this expression creates a reference which is immediately dereferenced by the compiler
112   --> $DIR/needless_borrow.rs:101:5
113    |
114 LL |     (&&()).foo();
115    |     ^^^^^^ help: change this to: `(&())`
116
117 error: this expression creates a reference which is immediately dereferenced by the compiler
118   --> $DIR/needless_borrow.rs:110:5
119    |
120 LL |     (&&5).foo();
121    |     ^^^^^ help: change this to: `(&5)`
122
123 error: the borrowed expression implements the required traits
124   --> $DIR/needless_borrow.rs:135:51
125    |
126 LL |     let _ = std::process::Command::new("ls").args(&["-a", "-l"]).status().unwrap();
127    |                                                   ^^^^^^^^^^^^^ help: change this to: `["-a", "-l"]`
128
129 error: the borrowed expression implements the required traits
130   --> $DIR/needless_borrow.rs:136:44
131    |
132 LL |     let _ = std::path::Path::new(".").join(&&".");
133    |                                            ^^^^^ help: change this to: `"."`
134
135 error: the borrowed expression implements the required traits
136   --> $DIR/needless_borrow.rs:137:23
137    |
138 LL |     deref_target_is_x(&X);
139    |                       ^^ help: change this to: `X`
140
141 error: the borrowed expression implements the required traits
142   --> $DIR/needless_borrow.rs:138:26
143    |
144 LL |     multiple_constraints(&[[""]]);
145    |                          ^^^^^^^ help: change this to: `[[""]]`
146
147 error: the borrowed expression implements the required traits
148   --> $DIR/needless_borrow.rs:139:45
149    |
150 LL |     multiple_constraints_normalizes_to_same(&X, X);
151    |                                             ^^ help: change this to: `X`
152
153 error: this expression creates a reference which is immediately dereferenced by the compiler
154   --> $DIR/needless_borrow.rs:140:32
155    |
156 LL |     let _ = Some("").unwrap_or(&"");
157    |                                ^^^ help: change this to: `""`
158
159 error: the borrowed expression implements the required traits
160   --> $DIR/needless_borrow.rs:141:33
161    |
162 LL |     let _ = std::fs::write("x", &"".to_string());
163    |                                 ^^^^^^^^^^^^^^^ help: change this to: `"".to_string()`
164
165 error: this expression borrows a value the compiler would automatically borrow
166   --> $DIR/needless_borrow.rs:192:13
167    |
168 LL |             (&self.f)()
169    |             ^^^^^^^^^ help: change this to: `(self.f)`
170
171 error: this expression borrows a value the compiler would automatically borrow
172   --> $DIR/needless_borrow.rs:201:13
173    |
174 LL |             (&mut self.f)()
175    |             ^^^^^^^^^^^^^ help: change this to: `(self.f)`
176
177 error: the borrowed expression implements the required traits
178   --> $DIR/needless_borrow.rs:286:20
179    |
180 LL |         takes_iter(&mut x)
181    |                    ^^^^^^ help: change this to: `x`
182
183 error: the borrowed expression implements the required traits
184   --> $DIR/needless_borrow.rs:304:55
185    |
186 LL |         let _ = std::process::Command::new("ls").args(&["-a", "-l"]).status().unwrap();
187    |                                                       ^^^^^^^^^^^^^ help: change this to: `["-a", "-l"]`
188
189 error: the borrowed expression implements the required traits
190   --> $DIR/needless_borrow.rs:344:37
191    |
192 LL |         let _ = std::fs::write("x", &arg);
193    |                                     ^^^^ help: change this to: `arg`
194
195 error: the borrowed expression implements the required traits
196   --> $DIR/needless_borrow.rs:345:37
197    |
198 LL |         let _ = std::fs::write("x", &loc);
199    |                                     ^^^^ help: change this to: `loc`
200
201 error: the borrowed expression implements the required traits
202   --> $DIR/needless_borrow.rs:364:15
203    |
204 LL |         debug(&x);
205    |               ^^ help: change this to: `x`
206
207 error: the borrowed expression implements the required traits
208   --> $DIR/needless_borrow.rs:374:15
209    |
210 LL |         use_x(&x);
211    |               ^^ help: change this to: `x`
212
213 error: aborting due to 35 previous errors
214