]> git.lizzy.rs Git - rust.git/blob - tests/ui/needless_pass_by_value.stderr
Duplicate ptr_arg's suggestion logic
[rust.git] / tests / ui / needless_pass_by_value.stderr
1 error: this argument is passed by value, but not consumed in the function body
2   --> $DIR/needless_pass_by_value.rs:12:23
3    |
4 12 | fn foo<T: Default>(v: Vec<T>, w: Vec<T>, mut x: Vec<T>, y: Vec<T>) -> Vec<T> {
5    |                       ^^^^^^ help: consider changing the type to: `&[T]`
6    |
7    = note: `-D needless-pass-by-value` implied by `-D warnings`
8
9 error: this argument is passed by value, but not consumed in the function body
10   --> $DIR/needless_pass_by_value.rs:26:11
11    |
12 26 | fn bar(x: String, y: Wrapper) {
13    |           ^^^^^^ help: consider changing the type to: `&str`
14
15 error: this argument is passed by value, but not consumed in the function body
16   --> $DIR/needless_pass_by_value.rs:26:22
17    |
18 26 | fn bar(x: String, y: Wrapper) {
19    |                      ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
20
21 error: this argument is passed by value, but not consumed in the function body
22   --> $DIR/needless_pass_by_value.rs:32:71
23    |
24 32 | fn test_borrow_trait<T: Borrow<str>, U: AsRef<str>, V>(t: T, u: U, v: V) {
25    |                                                                       ^ help: consider taking a reference instead: `&V`
26
27 error: this argument is passed by value, but not consumed in the function body
28   --> $DIR/needless_pass_by_value.rs:44:18
29    |
30 44 | fn test_match(x: Option<Option<String>>, y: Option<Option<String>>) {
31    |                  ^^^^^^^^^^^^^^^^^^^^^^
32    |
33 help: consider taking a reference instead
34    |
35 44 | fn test_match(x: &Option<Option<String>>, y: Option<Option<String>>) {
36 45 |     match *x {
37    |
38
39 error: this argument is passed by value, but not consumed in the function body
40   --> $DIR/needless_pass_by_value.rs:57:24
41    |
42 57 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
43    |                        ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
44
45 error: this argument is passed by value, but not consumed in the function body
46   --> $DIR/needless_pass_by_value.rs:57:36
47    |
48 57 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
49    |                                    ^^^^^^^
50    |
51 help: consider taking a reference instead
52    |
53 57 | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) {
54 58 |     let Wrapper(s) = z; // moved
55 59 |     let Wrapper(ref t) = *y; // not moved
56 60 |     let Wrapper(_) = *y; // still not moved
57    |
58
59 error: this argument is passed by value, but not consumed in the function body
60   --> $DIR/needless_pass_by_value.rs:73:49
61    |
62 73 | fn test_blanket_ref<T: Foo, S: Serialize>(_foo: T, _serializable: S) {}
63    |                                                 ^ help: consider taking a reference instead: `&T`
64
65 error: this argument is passed by value, but not consumed in the function body
66   --> $DIR/needless_pass_by_value.rs:75:18
67    |
68 75 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
69    |                  ^^^^^^ help: consider taking a reference instead: `&String`
70
71 error: this argument is passed by value, but not consumed in the function body
72   --> $DIR/needless_pass_by_value.rs:75:29
73    |
74 75 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
75    |                             ^^^^^^
76    |
77 help: consider changing the type to
78    |
79 75 | fn issue_2114(s: String, t: &str, u: Vec<i32>, v: Vec<i32>) {
80    |                             ^^^^
81 help: change `t.clone()` to
82    |
83 77 |     let _ = t.to_string();
84    |             ^^^^^^^^^^^^^
85
86 error: this argument is passed by value, but not consumed in the function body
87   --> $DIR/needless_pass_by_value.rs:75:40
88    |
89 75 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
90    |                                        ^^^^^^^^ help: consider taking a reference instead: `&Vec<i32>`
91
92 error: this argument is passed by value, but not consumed in the function body
93   --> $DIR/needless_pass_by_value.rs:75:53
94    |
95 75 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
96    |                                                     ^^^^^^^^
97    |
98 help: consider changing the type to
99    |
100 75 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: &[i32]) {
101    |                                                     ^^^^^^
102 help: change `v.clone()` to
103    |
104 79 |     let _ = v.to_owned();
105    |             ^^^^^^^^^^^^
106