]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mismatched_types/closure-arg-count.stderr
Hide some lints which are not quite right the way they are reported to the user
[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:15:15
3    |
4 LL |     [1, 2, 3].sort_by(|| panic!());
5    |               ^^^^^^^ -- takes 0 arguments
6    |               |
7    |               expected closure that takes 2 arguments
8
9 error[E0593]: closure is expected to take 2 arguments, but it takes 1 argument
10   --> $DIR/closure-arg-count.rs:17:15
11    |
12 LL |     [1, 2, 3].sort_by(|tuple| panic!());
13    |               ^^^^^^^ ------- takes 1 argument
14    |               |
15    |               expected closure that takes 2 arguments
16
17 error[E0593]: closure is expected to take 2 distinct arguments, but it takes a single 2-tuple as argument
18   --> $DIR/closure-arg-count.rs:19:15
19    |
20 LL |     [1, 2, 3].sort_by(|(tuple, tuple2)| panic!());
21    |               ^^^^^^^ ----------------- takes a single 2-tuple as argument
22    |               |
23    |               expected closure that takes 2 distinct arguments
24 help: change the closure to take multiple arguments instead of a single tuple
25    |
26 LL |     [1, 2, 3].sort_by(|tuple, tuple2| panic!());
27    |                       ^^^^^^^^^^^^^^^
28
29 error[E0593]: closure is expected to take 2 distinct arguments, but it takes a single 2-tuple as argument
30   --> $DIR/closure-arg-count.rs:21:15
31    |
32 LL |     [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!());
33    |               ^^^^^^^ ----------------------------- takes a single 2-tuple as argument
34    |               |
35    |               expected closure that takes 2 distinct arguments
36 help: change the closure to take multiple arguments instead of a single tuple
37    |
38 LL |     [1, 2, 3].sort_by(|tuple, tuple2| panic!());
39    |                       ^^^^^^^^^^^^^^^
40
41 error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
42   --> $DIR/closure-arg-count.rs:23:5
43    |
44 LL |     f(|| panic!());
45    |     ^ -- takes 0 arguments
46    |     |
47    |     expected closure that takes 1 argument
48    |
49 note: required by `f`
50   --> $DIR/closure-arg-count.rs:13:1
51    |
52 LL | fn f<F: Fn<usize>>(_: F) {}
53    | ^^^^^^^^^^^^^^^^^^^^^^^^
54
55 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
56   --> $DIR/closure-arg-count.rs:26:53
57    |
58 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
59    |                                                     ^^^ ------ takes 2 distinct arguments
60    |                                                     |
61    |                                                     expected closure that takes a single 2-tuple as argument
62 help: change the closure to accept a tuple instead of individual arguments
63    |
64 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
65    |                                                         ^^^^^^^^
66
67 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
68   --> $DIR/closure-arg-count.rs:28:53
69    |
70 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
71    |                                                     ^^^ ------------- takes 2 distinct arguments
72    |                                                     |
73    |                                                     expected closure that takes a single 2-tuple as argument
74 help: change the closure to accept a tuple instead of individual arguments
75    |
76 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
77    |                                                         ^^^^^^^^
78
79 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
80   --> $DIR/closure-arg-count.rs:30:53
81    |
82 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
83    |                                                     ^^^ --------- takes 3 distinct arguments
84    |                                                     |
85    |                                                     expected closure that takes a single 2-tuple as argument
86
87 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments
88   --> $DIR/closure-arg-count.rs:32:53
89    |
90 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
91    |                                                     ^^^ expected function that takes a single 2-tuple as argument
92 ...
93 LL | fn foo() {}
94    | -------- takes 0 arguments
95
96 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
97   --> $DIR/closure-arg-count.rs:35:53
98    |
99 LL |     let bar = |i, x, y| i;
100    |               --------- takes 3 distinct arguments
101 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(bar);
102    |                                                     ^^^ expected closure that takes a single 2-tuple as argument
103
104 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
105   --> $DIR/closure-arg-count.rs:37:53
106    |
107 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
108    |                                                     ^^^ expected function that takes a single 2-tuple as argument
109 ...
110 LL | fn qux(x: usize, y: usize) {}
111    | -------------------------- takes 2 distinct arguments
112
113 error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
114   --> $DIR/closure-arg-count.rs:40:41
115    |
116 LL |     let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
117    |                                         ^^^ expected function that takes 1 argument
118
119 error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
120   --> $DIR/closure-arg-count.rs:43:5
121    |
122 LL |     call(Foo);
123    |     ^^^^ expected function that takes 0 arguments
124 ...
125 LL | struct Foo(u8);
126    | --------------- takes 1 argument
127    |
128 note: required by `call`
129   --> $DIR/closure-arg-count.rs:50:1
130    |
131 LL | fn call<F, R>(_: F) where F: FnOnce() -> R {}
132    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
133
134 error: aborting due to 13 previous errors
135
136 For more information about this error, try `rustc --explain E0593`.