mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 01:17:16 +00:00
08d6b3d2f6
This is a follow-up to #2951 that extends the logic to allow for returning references inside structs/enums/unions. This was a simple oversight in the first version and it's surprisingly easy to handle.
82 lines
3.6 KiB
Text
82 lines
3.6 KiB
Text
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:40:11
|
|
|
|
|
40 | fn bad(x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^ help: consider passing by value instead: `u32`
|
|
|
|
|
= note: `-D trivially-copy-pass-by-ref` implied by `-D warnings`
|
|
|
|
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:40:20
|
|
|
|
|
40 | fn bad(x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^ help: consider passing by value instead: `Foo`
|
|
|
|
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:40:29
|
|
|
|
|
40 | fn bad(x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^ help: consider passing by value instead: `Baz`
|
|
|
|
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:50:12
|
|
|
|
|
50 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^^ help: consider passing by value instead: `self`
|
|
|
|
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:50:22
|
|
|
|
|
50 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^ help: consider passing by value instead: `u32`
|
|
|
|
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:50:31
|
|
|
|
|
50 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^ help: consider passing by value instead: `Foo`
|
|
|
|
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:50:40
|
|
|
|
|
50 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^ help: consider passing by value instead: `Baz`
|
|
|
|
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:53:16
|
|
|
|
|
53 | fn bad2(x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^ help: consider passing by value instead: `u32`
|
|
|
|
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:53:25
|
|
|
|
|
53 | fn bad2(x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^ help: consider passing by value instead: `Foo`
|
|
|
|
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:53:34
|
|
|
|
|
53 | fn bad2(x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^ help: consider passing by value instead: `Baz`
|
|
|
|
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:67:16
|
|
|
|
|
67 | fn bad2(x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^ help: consider passing by value instead: `u32`
|
|
|
|
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:67:25
|
|
|
|
|
67 | fn bad2(x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^ help: consider passing by value instead: `Foo`
|
|
|
|
error: this argument is passed by reference, but would be more efficient if passed by value
|
|
--> $DIR/trivially_copy_pass_by_ref.rs:67:34
|
|
|
|
|
67 | fn bad2(x: &u32, y: &Foo, z: &Baz) {
|
|
| ^^^^ help: consider passing by value instead: `Baz`
|
|
|
|
error: aborting due to 13 previous errors
|
|
|