]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mismatched_types/closure-arg-count.stderr
Merge commit 'bf1c6f9871f430e284b17aa44059e0d0395e28a6' into clippyup
[rust.git] / src / test / 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 | fn f<F: Fn<usize>>(_: F) {}
52    |         --------- required by this bound in `f`
53 ...
54 LL |     f(|| panic!());
55    |     ^ -- takes 0 arguments
56    |     |
57    |     expected closure that takes 1 argument
58    |
59 help: consider changing the closure to take and ignore the expected argument
60    |
61 LL |     f(|_| panic!());
62    |       ^^^
63
64 error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
65   --> $DIR/closure-arg-count.rs:15:5
66    |
67 LL | fn f<F: Fn<usize>>(_: F) {}
68    |         --------- required by this bound in `f`
69 ...
70 LL |     f(  move    || panic!());
71    |     ^   ---------- takes 0 arguments
72    |     |
73    |     expected closure that takes 1 argument
74    |
75 help: consider changing the closure to take and ignore the expected argument
76    |
77 LL |     f(  move    |_| panic!());
78    |                 ^^^
79
80 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
81   --> $DIR/closure-arg-count.rs:18:53
82    |
83 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
84    |                                                     ^^^ ------ takes 2 distinct arguments
85    |                                                     |
86    |                                                     expected closure that takes a single 2-tuple as argument
87    |
88 help: change the closure to accept a tuple instead of individual arguments
89    |
90 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
91    |                                                         ^^^^^^^^
92
93 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
94   --> $DIR/closure-arg-count.rs:20:53
95    |
96 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
97    |                                                     ^^^ ------------- takes 2 distinct arguments
98    |                                                     |
99    |                                                     expected closure that takes a single 2-tuple as argument
100    |
101 help: change the closure to accept a tuple instead of individual arguments
102    |
103 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
104    |                                                         ^^^^^^^^
105
106 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
107   --> $DIR/closure-arg-count.rs:22:53
108    |
109 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
110    |                                                     ^^^ --------- takes 3 distinct arguments
111    |                                                     |
112    |                                                     expected closure that takes a single 2-tuple as argument
113
114 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments
115   --> $DIR/closure-arg-count.rs:24:57
116    |
117 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
118    |                                                         ^^^ expected function that takes a single 2-tuple as argument
119 ...
120 LL | fn foo() {}
121    | -------- takes 0 arguments
122
123 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
124   --> $DIR/closure-arg-count.rs:27:57
125    |
126 LL |     let bar = |i, x, y| i;
127    |               --------- takes 3 distinct arguments
128 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(bar);
129    |                                                         ^^^ expected closure that takes a single 2-tuple as argument
130
131 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
132   --> $DIR/closure-arg-count.rs:29:57
133    |
134 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
135    |                                                         ^^^ expected function that takes a single 2-tuple as argument
136 ...
137 LL | fn qux(x: usize, y: usize) {}
138    | -------------------------- takes 2 distinct arguments
139
140 error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
141   --> $DIR/closure-arg-count.rs:32:45
142    |
143 LL |     let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
144    |                                             ^^^^^^^^^^^^^^^^^^ expected function that takes 1 argument
145
146 error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
147   --> $DIR/closure-arg-count.rs:35:10
148    |
149 LL |     call(Foo);
150    |          ^^^ expected function that takes 0 arguments
151 ...
152 LL | fn call<F, R>(_: F) where F: FnOnce() -> R {}
153    |                              ------------- required by this bound in `call`
154 LL | struct Foo(u8);
155    | --------------- takes 1 argument
156
157 error: aborting due to 14 previous errors
158
159 For more information about this error, try `rustc --explain E0593`.