2017-02-19 21:50:31 -06:00
|
|
|
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> {
|
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/needless_pass_by_value.rs:4:9
|
|
|
|
|
|
|
|
|
4 | #![deny(needless_pass_by_value)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
help: consider changing the type to `&[T]`
|
|
|
|
| fn foo<T: Default>(v: &[T], w: Vec<T>, mut x: Vec<T>, y: Vec<T>) -> Vec<T> {
|
|
|
|
|
|
|
|
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`
|
|
|
|
| fn bar(x: &str, y: Wrapper) {
|
|
|
|
|
|
|
|
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
|
|
|
|
| fn bar(x: String, y: &Wrapper) {
|
|
|
|
|
|
|
|
error: this argument is passed by value, but not consumed in the function body
|
2017-02-20 01:45:37 -06:00
|
|
|
--> $DIR/needless_pass_by_value.rs:29:63
|
2017-02-19 21:50:31 -06:00
|
|
|
|
|
2017-02-20 01:45:37 -06:00
|
|
|
29 | fn test_borrow_trait<T: std::borrow::Borrow<str>, U>(t: T, u: U) {
|
2017-02-19 21:50:31 -06:00
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: consider taking a reference instead
|
|
|
|
| fn test_borrow_trait<T: std::borrow::Borrow<str>, U>(t: T, u: &U) {
|
|
|
|
|
2017-02-20 01:45:37 -06:00
|
|
|
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
|
|
|
|
| fn test_match(x: &Option<Option<String>>, y: Option<Option<String>>) {
|
|
|
|
help: ...and dereference it here
|
|
|
|
| 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) {
|
|
|
|
| ^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider taking a reference instead
|
|
|
|
| fn test_destructure(x: &Wrapper, y: Wrapper) {
|
|
|
|
|
|
|
|
error: aborting due to 6 previous errors
|
2017-02-19 21:50:31 -06:00
|
|
|
|