2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:15:15
|
2017-05-17 07:19:44 -05:00
|
|
|
|
|
2021-09-09 10:38:03 -05:00
|
|
|
LL | let _ = x(&&a); // warn
|
2017-09-15 21:27:46 -05:00
|
|
|
| ^^^ help: change this to: `&a`
|
2017-05-17 07:19:44 -05:00
|
|
|
|
|
2018-08-01 09:30:44 -05:00
|
|
|
= note: `-D clippy::needless-borrow` implied by `-D warnings`
|
2017-05-17 07:19:44 -05:00
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:19:13
|
2021-09-09 10:38:03 -05:00
|
|
|
|
|
|
|
|
LL | mut_ref(&mut &mut b); // warn
|
|
|
|
| ^^^^^^^^^^^ help: change this to: `&mut b`
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:31:13
|
2021-11-15 10:58:25 -06:00
|
|
|
|
|
|
|
|
LL | &&a
|
|
|
|
| ^^^ help: change this to: `&a`
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:33:15
|
2017-05-17 07:19:44 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | 46 => &&a,
|
2017-09-15 21:27:46 -05:00
|
|
|
| ^^^ help: change this to: `&a`
|
2017-05-17 07:19:44 -05:00
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:39:27
|
2021-11-15 10:58:25 -06:00
|
|
|
|
|
|
|
|
LL | break &ref_a;
|
|
|
|
| ^^^^^^ help: change this to: `ref_a`
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:46:15
|
2021-11-15 10:58:25 -06:00
|
|
|
|
|
|
|
|
LL | let _ = x(&&&a);
|
|
|
|
| ^^^^ help: change this to: `&a`
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:47:15
|
2021-11-15 10:58:25 -06:00
|
|
|
|
|
|
|
|
LL | let _ = x(&mut &&a);
|
|
|
|
| ^^^^^^^^ help: change this to: `&a`
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:48:15
|
2021-11-15 10:58:25 -06:00
|
|
|
|
|
|
|
|
LL | let _ = x(&&&mut b);
|
|
|
|
| ^^^^^^^^ help: change this to: `&mut b`
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:49:15
|
2021-11-15 10:58:25 -06:00
|
|
|
|
|
|
|
|
LL | let _ = x(&&ref_a);
|
|
|
|
| ^^^^^^^ help: change this to: `ref_a`
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:52:11
|
2021-11-15 10:58:25 -06:00
|
|
|
|
|
|
|
|
LL | x(&b);
|
|
|
|
| ^^ help: change this to: `b`
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:59:13
|
2022-01-03 11:44:33 -06:00
|
|
|
|
|
|
|
|
LL | mut_ref(&mut x);
|
|
|
|
| ^^^^^^ help: change this to: `x`
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:60:13
|
2022-01-03 11:44:33 -06:00
|
|
|
|
|
|
|
|
LL | mut_ref(&mut &mut x);
|
|
|
|
| ^^^^^^^^^^^ help: change this to: `x`
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:61:23
|
2022-01-03 11:44:33 -06:00
|
|
|
|
|
|
|
|
LL | let y: &mut i32 = &mut x;
|
|
|
|
| ^^^^^^ help: change this to: `x`
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:62:23
|
2022-01-03 11:44:33 -06:00
|
|
|
|
|
|
|
|
LL | let y: &mut i32 = &mut &mut x;
|
|
|
|
| ^^^^^^^^^^^ help: change this to: `x`
|
|
|
|
|
2022-01-27 19:03:50 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:71:14
|
2022-01-27 19:03:50 -06:00
|
|
|
|
|
|
|
|
LL | 0 => &mut x,
|
|
|
|
| ^^^^^^ help: change this to: `x`
|
|
|
|
|
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:77:14
|
2022-01-27 19:03:50 -06:00
|
|
|
|
|
|
|
|
LL | 0 => &mut x,
|
|
|
|
| ^^^^^^ help: change this to: `x`
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
error: this expression borrows a value the compiler would automatically borrow
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:89:13
|
2022-01-11 13:31:35 -06:00
|
|
|
|
|
|
|
|
LL | let _ = (&x).0;
|
|
|
|
| ^^^^ help: change this to: `x`
|
|
|
|
|
|
|
|
error: this expression borrows a value the compiler would automatically borrow
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:91:22
|
2022-01-11 13:31:35 -06:00
|
|
|
|
|
|
|
|
LL | let _ = unsafe { (&*x).0 };
|
|
|
|
| ^^^^^ help: change this to: `(*x)`
|
|
|
|
|
2022-01-29 19:29:43 -06:00
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:101:5
|
2022-01-29 19:29:43 -06:00
|
|
|
|
|
|
|
|
LL | (&&()).foo();
|
|
|
|
| ^^^^^^ help: change this to: `(&())`
|
|
|
|
|
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:110:5
|
2022-01-29 19:29:43 -06:00
|
|
|
|
|
|
|
|
LL | (&&5).foo();
|
|
|
|
| ^^^^^ help: change this to: `(&5)`
|
|
|
|
|
2022-07-08 04:29:10 -05:00
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:135:51
|
2022-07-08 04:29:10 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::process::Command::new("ls").args(&["-a", "-l"]).status().unwrap();
|
|
|
|
| ^^^^^^^^^^^^^ help: change this to: `["-a", "-l"]`
|
|
|
|
|
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:136:44
|
2022-07-08 04:29:10 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::path::Path::new(".").join(&&".");
|
|
|
|
| ^^^^^ help: change this to: `"."`
|
|
|
|
|
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:137:23
|
2022-07-08 04:29:10 -05:00
|
|
|
|
|
|
|
|
LL | deref_target_is_x(&X);
|
|
|
|
| ^^ help: change this to: `X`
|
|
|
|
|
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:138:26
|
2022-07-08 04:29:10 -05:00
|
|
|
|
|
|
|
|
LL | multiple_constraints(&[[""]]);
|
|
|
|
| ^^^^^^^ help: change this to: `[[""]]`
|
|
|
|
|
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:139:45
|
2022-07-08 04:29:10 -05:00
|
|
|
|
|
|
|
|
LL | multiple_constraints_normalizes_to_same(&X, X);
|
|
|
|
| ^^ help: change this to: `X`
|
|
|
|
|
|
|
|
error: this expression creates a reference which is immediately dereferenced by the compiler
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:140:32
|
2022-07-08 04:29:10 -05:00
|
|
|
|
|
|
|
|
LL | let _ = Some("").unwrap_or(&"");
|
|
|
|
| ^^^ help: change this to: `""`
|
|
|
|
|
2022-08-24 19:14:21 -05:00
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:141:33
|
2022-08-24 19:14:21 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::fs::write("x", &"".to_string());
|
|
|
|
| ^^^^^^^^^^^^^^^ help: change this to: `"".to_string()`
|
|
|
|
|
2022-07-19 14:17:24 -05:00
|
|
|
error: this expression borrows a value the compiler would automatically borrow
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:190:13
|
2022-07-19 14:17:24 -05:00
|
|
|
|
|
|
|
|
LL | (&self.f)()
|
|
|
|
| ^^^^^^^^^ help: change this to: `(self.f)`
|
|
|
|
|
|
|
|
error: this expression borrows a value the compiler would automatically borrow
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:199:13
|
2022-07-19 14:17:24 -05:00
|
|
|
|
|
|
|
|
LL | (&mut self.f)()
|
|
|
|
| ^^^^^^^^^^^^^ help: change this to: `(self.f)`
|
|
|
|
|
2022-07-08 04:29:10 -05:00
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:283:20
|
2022-08-24 19:14:21 -05:00
|
|
|
|
|
|
|
|
LL | takes_iter(&mut x)
|
|
|
|
| ^^^^^^ help: change this to: `x`
|
|
|
|
|
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:297:55
|
2022-07-08 04:29:10 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::process::Command::new("ls").args(&["-a", "-l"]).status().unwrap();
|
|
|
|
| ^^^^^^^^^^^^^ help: change this to: `["-a", "-l"]`
|
|
|
|
|
2022-08-24 19:14:21 -05:00
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:335:37
|
2022-08-24 19:14:21 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::fs::write("x", &arg);
|
|
|
|
| ^^^^ help: change this to: `arg`
|
|
|
|
|
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:336:37
|
2022-08-24 19:14:21 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::fs::write("x", &loc);
|
|
|
|
| ^^^^ help: change this to: `loc`
|
|
|
|
|
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:354:15
|
2022-08-24 19:14:21 -05:00
|
|
|
|
|
|
|
|
LL | debug(&x);
|
|
|
|
| ^^ help: change this to: `x`
|
|
|
|
|
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:363:15
|
2022-08-24 19:14:21 -05:00
|
|
|
|
|
|
|
|
LL | use_x(&x);
|
|
|
|
| ^^ help: change this to: `x`
|
|
|
|
|
2022-11-04 06:19:45 -05:00
|
|
|
error: the borrowed expression implements the required traits
|
2023-07-27 06:40:22 -05:00
|
|
|
--> $DIR/needless_borrow.rs:457:13
|
2022-11-04 06:19:45 -05:00
|
|
|
|
|
|
|
|
LL | foo(&a);
|
|
|
|
| ^^ help: change this to: `a`
|
|
|
|
|
2023-01-12 12:28:22 -06:00
|
|
|
error: aborting due to 36 previous errors
|
2018-01-16 10:06:27 -06:00
|
|
|
|