mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-30 15:03:36 +00:00
60 lines
2.3 KiB
Text
60 lines
2.3 KiB
Text
error: this argument is passed by value, but not consumed in the function body
|
|
--> $DIR/needless_pass_by_value.rs:9:23
|
|
|
|
|
9 | fn foo<T: Default>(v: Vec<T>, w: Vec<T>, mut x: Vec<T>, y: Vec<T>) -> Vec<T> {
|
|
| ^^^^^^ help: consider changing the type to: `&[T]`
|
|
|
|
|
= note: `-D needless-pass-by-value` implied by `-D warnings`
|
|
|
|
error: this argument is passed by value, but not consumed in the function body
|
|
--> $DIR/needless_pass_by_value.rs:23:11
|
|
|
|
|
23 | fn bar(x: String, y: Wrapper) {
|
|
| ^^^^^^ help: consider changing the type to: `&str`
|
|
|
|
error: this argument is passed by value, but not consumed in the function body
|
|
--> $DIR/needless_pass_by_value.rs:23:22
|
|
|
|
|
23 | fn bar(x: String, y: Wrapper) {
|
|
| ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
|
|
|
|
error: this argument is passed by value, but not consumed in the function body
|
|
--> $DIR/needless_pass_by_value.rs:29:63
|
|
|
|
|
29 | fn test_borrow_trait<T: std::borrow::Borrow<str>, U>(t: T, u: U) {
|
|
| ^ help: consider taking a reference instead: `&U`
|
|
|
|
error: this argument is passed by value, but not consumed in the function body
|
|
--> $DIR/needless_pass_by_value.rs:40:18
|
|
|
|
|
40 | fn test_match(x: Option<Option<String>>, y: Option<Option<String>>) {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: consider taking a reference instead
|
|
|
|
|
40 | fn test_match(x: &Option<Option<String>>, y: Option<Option<String>>) {
|
|
41 | match *x {
|
|
|
|
|
|
|
error: this argument is passed by value, but not consumed in the function body
|
|
--> $DIR/needless_pass_by_value.rs:53:24
|
|
|
|
|
53 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
|
|
| ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
|
|
|
|
error: this argument is passed by value, but not consumed in the function body
|
|
--> $DIR/needless_pass_by_value.rs:53:36
|
|
|
|
|
53 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
|
|
| ^^^^^^^
|
|
|
|
|
help: consider taking a reference instead
|
|
|
|
|
53 | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) {
|
|
54 | let Wrapper(s) = z; // moved
|
|
55 | let Wrapper(ref t) = *y; // not moved
|
|
56 | let Wrapper(_) = *y; // still not moved
|
|
|
|
|
|
|
error: aborting due to 7 previous errors
|
|
|