]> git.lizzy.rs Git - rust.git/blob - tests/ui/needless_pass_by_value.stderr
Auto merge of #4478 - tsurai:master, r=flip1995
[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:16:23
3    |
4 LL | 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 clippy::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:30:11
11    |
12 LL | 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:30:22
17    |
18 LL | 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:36:71
23    |
24 LL | 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:48:18
29    |
30 LL | fn test_match(x: Option<Option<String>>, y: Option<Option<String>>) {
31    |                  ^^^^^^^^^^^^^^^^^^^^^^
32 help: consider taking a reference instead
33    |
34 LL | fn test_match(x: &Option<Option<String>>, y: Option<Option<String>>) {
35 LL |     match *x {
36    |
37
38 error: this argument is passed by value, but not consumed in the function body
39   --> $DIR/needless_pass_by_value.rs:61:24
40    |
41 LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
42    |                        ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
43
44 error: this argument is passed by value, but not consumed in the function body
45   --> $DIR/needless_pass_by_value.rs:61:36
46    |
47 LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
48    |                                    ^^^^^^^
49 help: consider taking a reference instead
50    |
51 LL | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) {
52 LL |     let Wrapper(s) = z; // moved
53 LL |     let Wrapper(ref t) = *y; // not moved
54 LL |     let Wrapper(_) = *y; // still not moved
55    |
56
57 error: this argument is passed by value, but not consumed in the function body
58   --> $DIR/needless_pass_by_value.rs:77:49
59    |
60 LL | fn test_blanket_ref<T: Foo, S: Serialize>(_foo: T, _serializable: S) {}
61    |                                                 ^ help: consider taking a reference instead: `&T`
62
63 error: this argument is passed by value, but not consumed in the function body
64   --> $DIR/needless_pass_by_value.rs:79:18
65    |
66 LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
67    |                  ^^^^^^ help: consider taking a reference instead: `&String`
68
69 error: this argument is passed by value, but not consumed in the function body
70   --> $DIR/needless_pass_by_value.rs:79:29
71    |
72 LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
73    |                             ^^^^^^
74 help: consider changing the type to
75    |
76 LL | fn issue_2114(s: String, t: &str, u: Vec<i32>, v: Vec<i32>) {
77    |                             ^^^^
78 help: change `t.clone()` to
79    |
80 LL |     let _ = t.to_string();
81    |             ^^^^^^^^^^^^^
82
83 error: this argument is passed by value, but not consumed in the function body
84   --> $DIR/needless_pass_by_value.rs:79:40
85    |
86 LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
87    |                                        ^^^^^^^^ help: consider taking a reference instead: `&Vec<i32>`
88
89 error: this argument is passed by value, but not consumed in the function body
90   --> $DIR/needless_pass_by_value.rs:79:53
91    |
92 LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
93    |                                                     ^^^^^^^^
94 help: consider changing the type to
95    |
96 LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: &[i32]) {
97    |                                                     ^^^^^^
98 help: change `v.clone()` to
99    |
100 LL |     let _ = v.to_owned();
101    |             ^^^^^^^^^^^^
102
103 error: this argument is passed by value, but not consumed in the function body
104   --> $DIR/needless_pass_by_value.rs:92:12
105    |
106 LL |         s: String,
107    |            ^^^^^^ help: consider changing the type to: `&str`
108
109 error: this argument is passed by value, but not consumed in the function body
110   --> $DIR/needless_pass_by_value.rs:93:12
111    |
112 LL |         t: String,
113    |            ^^^^^^ help: consider taking a reference instead: `&String`
114
115 error: this argument is passed by value, but not consumed in the function body
116   --> $DIR/needless_pass_by_value.rs:102:23
117    |
118 LL |     fn baz(&self, _u: U, _s: Self) {}
119    |                       ^ help: consider taking a reference instead: `&U`
120
121 error: this argument is passed by value, but not consumed in the function body
122   --> $DIR/needless_pass_by_value.rs:102:30
123    |
124 LL |     fn baz(&self, _u: U, _s: Self) {}
125    |                              ^^^^ help: consider taking a reference instead: `&Self`
126
127 error: this argument is passed by value, but not consumed in the function body
128   --> $DIR/needless_pass_by_value.rs:124:24
129    |
130 LL | fn bar_copy(x: u32, y: CopyWrapper) {
131    |                        ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
132    |
133 help: consider marking this type as Copy
134   --> $DIR/needless_pass_by_value.rs:122:1
135    |
136 LL | struct CopyWrapper(u32);
137    | ^^^^^^^^^^^^^^^^^^^^^^^^
138
139 error: this argument is passed by value, but not consumed in the function body
140   --> $DIR/needless_pass_by_value.rs:130:29
141    |
142 LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
143    |                             ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
144    |
145 help: consider marking this type as Copy
146   --> $DIR/needless_pass_by_value.rs:122:1
147    |
148 LL | struct CopyWrapper(u32);
149    | ^^^^^^^^^^^^^^^^^^^^^^^^
150
151 error: this argument is passed by value, but not consumed in the function body
152   --> $DIR/needless_pass_by_value.rs:130:45
153    |
154 LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
155    |                                             ^^^^^^^^^^^
156    |
157 help: consider marking this type as Copy
158   --> $DIR/needless_pass_by_value.rs:122:1
159    |
160 LL | struct CopyWrapper(u32);
161    | ^^^^^^^^^^^^^^^^^^^^^^^^
162 help: consider taking a reference instead
163    |
164 LL | fn test_destructure_copy(x: CopyWrapper, y: &CopyWrapper, z: CopyWrapper) {
165 LL |     let CopyWrapper(s) = z; // moved
166 LL |     let CopyWrapper(ref t) = *y; // not moved
167 LL |     let CopyWrapper(_) = *y; // still not moved
168    |
169
170 error: this argument is passed by value, but not consumed in the function body
171   --> $DIR/needless_pass_by_value.rs:130:61
172    |
173 LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
174    |                                                             ^^^^^^^^^^^
175    |
176 help: consider marking this type as Copy
177   --> $DIR/needless_pass_by_value.rs:122:1
178    |
179 LL | struct CopyWrapper(u32);
180    | ^^^^^^^^^^^^^^^^^^^^^^^^
181 help: consider taking a reference instead
182    |
183 LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: &CopyWrapper) {
184 LL |     let CopyWrapper(s) = *z; // moved
185    |
186
187 error: this argument is passed by value, but not consumed in the function body
188   --> $DIR/needless_pass_by_value.rs:142:40
189    |
190 LL | fn some_fun<'b, S: Bar<'b, ()>>(_item: S) {}
191    |                                        ^ help: consider taking a reference instead: `&S`
192
193 error: this argument is passed by value, but not consumed in the function body
194   --> $DIR/needless_pass_by_value.rs:147:20
195    |
196 LL | fn more_fun(_item: impl Club<'static, i32>) {}
197    |                    ^^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&impl Club<'static, i32>`
198
199 error: aborting due to 22 previous errors
200