mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 17:07:17 +00:00
38d4ac7cea
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
34 lines
1.2 KiB
Text
34 lines
1.2 KiB
Text
error: `ref` directly on a function argument is ignored. Consider using a reference type instead.
|
|
--> $DIR/toplevel_ref_arg.rs:4:15
|
|
|
|
|
LL | fn the_answer(ref mut x: u8) {
|
|
| ^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::toplevel-ref-arg` implied by `-D warnings`
|
|
|
|
error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead
|
|
--> $DIR/toplevel_ref_arg.rs:15:9
|
|
|
|
|
LL | let ref x = 1;
|
|
| ----^^^^^----- help: try: `let x = &1;`
|
|
|
|
error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead
|
|
--> $DIR/toplevel_ref_arg.rs:17:9
|
|
|
|
|
LL | let ref y: (&_, u8) = (&1, 2);
|
|
| ----^^^^^--------------------- help: try: `let y: &(&_, u8) = &(&1, 2);`
|
|
|
|
error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead
|
|
--> $DIR/toplevel_ref_arg.rs:19:9
|
|
|
|
|
LL | let ref z = 1 + 2;
|
|
| ----^^^^^--------- help: try: `let z = &(1 + 2);`
|
|
|
|
error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead
|
|
--> $DIR/toplevel_ref_arg.rs:21:9
|
|
|
|
|
LL | let ref mut z = 1 + 2;
|
|
| ----^^^^^^^^^--------- help: try: `let z = &mut (1 + 2);`
|
|
|
|
error: aborting due to 5 previous errors
|
|
|