]> git.lizzy.rs Git - rust.git/blob - tests/ui/mismatched_types/closure-arg-count.stderr
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / tests / ui / mismatched_types / closure-arg-count.stderr
1 error[E0593]: closure is expected to take 2 arguments, but it takes 0 arguments
2   --> $DIR/closure-arg-count.rs:5:15
3    |
4 LL |     [1, 2, 3].sort_by(|| panic!());
5    |               ^^^^^^^ -- takes 0 arguments
6    |               |
7    |               expected closure that takes 2 arguments
8    |
9 help: consider changing the closure to take and ignore the expected arguments
10    |
11 LL |     [1, 2, 3].sort_by(|_, _| panic!());
12    |                       ~~~~~~
13
14 error[E0593]: closure is expected to take 2 arguments, but it takes 1 argument
15   --> $DIR/closure-arg-count.rs:7:15
16    |
17 LL |     [1, 2, 3].sort_by(|tuple| panic!());
18    |               ^^^^^^^ ------- takes 1 argument
19    |               |
20    |               expected closure that takes 2 arguments
21
22 error[E0593]: closure is expected to take 2 distinct arguments, but it takes a single 2-tuple as argument
23   --> $DIR/closure-arg-count.rs:9:15
24    |
25 LL |     [1, 2, 3].sort_by(|(tuple, tuple2)| panic!());
26    |               ^^^^^^^ ----------------- takes a single 2-tuple as argument
27    |               |
28    |               expected closure that takes 2 distinct arguments
29    |
30 help: change the closure to take multiple arguments instead of a single tuple
31    |
32 LL |     [1, 2, 3].sort_by(|tuple, tuple2| panic!());
33    |                       ~~~~~~~~~~~~~~~
34
35 error[E0593]: closure is expected to take 2 distinct arguments, but it takes a single 2-tuple as argument
36   --> $DIR/closure-arg-count.rs:11:15
37    |
38 LL |     [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!());
39    |               ^^^^^^^ ----------------------------- takes a single 2-tuple as argument
40    |               |
41    |               expected closure that takes 2 distinct arguments
42    |
43 help: change the closure to take multiple arguments instead of a single tuple
44    |
45 LL |     [1, 2, 3].sort_by(|tuple, tuple2| panic!());
46    |                       ~~~~~~~~~~~~~~~
47
48 error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
49   --> $DIR/closure-arg-count.rs:13:5
50    |
51 LL |     f(|| panic!());
52    |     ^ -- takes 0 arguments
53    |     |
54    |     expected closure that takes 1 argument
55    |
56 note: required by a bound in `f`
57   --> $DIR/closure-arg-count.rs:3:9
58    |
59 LL | fn f<F: Fn<(usize,)>>(_: F) {}
60    |         ^^^^^^^^^^^^ required by this bound in `f`
61 help: consider changing the closure to take and ignore the expected argument
62    |
63 LL |     f(|_| panic!());
64    |       ~~~
65
66 error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
67   --> $DIR/closure-arg-count.rs:15:5
68    |
69 LL |     f(  move    || panic!());
70    |     ^   ---------- takes 0 arguments
71    |     |
72    |     expected closure that takes 1 argument
73    |
74 note: required by a bound in `f`
75   --> $DIR/closure-arg-count.rs:3:9
76    |
77 LL | fn f<F: Fn<(usize,)>>(_: F) {}
78    |         ^^^^^^^^^^^^ required by this bound in `f`
79 help: consider changing the closure to take and ignore the expected argument
80    |
81 LL |     f(  move    |_| panic!());
82    |                 ~~~
83
84 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
85   --> $DIR/closure-arg-count.rs:18:53
86    |
87 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
88    |                                                     ^^^ ------ takes 2 distinct arguments
89    |                                                     |
90    |                                                     expected closure that takes a single 2-tuple as argument
91    |
92 help: change the closure to accept a tuple instead of individual arguments
93    |
94 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
95    |                                                         ~~~~~~~~
96
97 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
98   --> $DIR/closure-arg-count.rs:20:53
99    |
100 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
101    |                                                     ^^^ ------------- takes 2 distinct arguments
102    |                                                     |
103    |                                                     expected closure that takes a single 2-tuple as argument
104    |
105 help: change the closure to accept a tuple instead of individual arguments
106    |
107 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
108    |                                                         ~~~~~~~~
109
110 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
111   --> $DIR/closure-arg-count.rs:22:53
112    |
113 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
114    |                                                     ^^^ --------- takes 3 distinct arguments
115    |                                                     |
116    |                                                     expected closure that takes a single 2-tuple as argument
117
118 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments
119   --> $DIR/closure-arg-count.rs:24:57
120    |
121 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
122    |                                                     --- ^^^ expected function that takes a single 2-tuple as argument
123    |                                                     |
124    |                                                     required by a bound introduced by this call
125 ...
126 LL | fn foo() {}
127    | -------- takes 0 arguments
128    |
129 note: required by a bound in `map`
130   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
131
132 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
133   --> $DIR/closure-arg-count.rs:27:57
134    |
135 LL |     let bar = |i, x, y| i;
136    |               --------- takes 3 distinct arguments
137 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(bar);
138    |                                                     --- ^^^ expected closure that takes a single 2-tuple as argument
139    |                                                     |
140    |                                                     required by a bound introduced by this call
141    |
142 note: required by a bound in `map`
143   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
144
145 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
146   --> $DIR/closure-arg-count.rs:29:57
147    |
148 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
149    |                                                     --- ^^^ expected function that takes a single 2-tuple as argument
150    |                                                     |
151    |                                                     required by a bound introduced by this call
152 ...
153 LL | fn qux(x: usize, y: usize) {}
154    | -------------------------- takes 2 distinct arguments
155    |
156 note: required by a bound in `map`
157   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
158
159 error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
160   --> $DIR/closure-arg-count.rs:32:45
161    |
162 LL |     let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
163    |                                         --- ^^^^^^^^^^^^^^^^^^ expected function that takes 1 argument
164    |                                         |
165    |                                         required by a bound introduced by this call
166    |
167 note: required by a bound in `map`
168   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
169
170 error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
171   --> $DIR/closure-arg-count.rs:35:10
172    |
173 LL |     call(Foo);
174    |     ---- ^^^ expected function that takes 0 arguments
175    |     |
176    |     required by a bound introduced by this call
177 ...
178 LL | struct Foo(u8);
179    | ---------- takes 1 argument
180    |
181 note: required by a bound in `call`
182   --> $DIR/closure-arg-count.rs:42:30
183    |
184 LL | fn call<F, R>(_: F) where F: FnOnce() -> R {}
185    |                              ^^^^^^^^^^^^^ required by this bound in `call`
186
187 error: aborting due to 14 previous errors
188
189 For more information about this error, try `rustc --explain E0593`.