]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/args-instead-of-tuple.rs
Rollup merge of #107524 - cjgillot:both-storage, r=RalfJung
[rust.git] / tests / ui / suggestions / args-instead-of-tuple.rs
1 // Test suggesting tuples where bare arguments may have been passed
2 // See issue #86481 for details.
3
4 // run-rustfix
5
6 fn main() {
7     let _: Result<(i32, i8), ()> = Ok(1, 2);
8     //~^ ERROR enum variant takes 1 argument but 2 arguments were supplied
9     let _: Option<(i32, i8, &'static str)> = Some(1, 2, "hi");
10     //~^ ERROR enum variant takes 1 argument but 3 arguments were supplied
11     let _: Option<()> = Some();
12     //~^ ERROR enum variant takes 1 argument but 0 arguments were supplied
13
14     let _: Option<(i32,)> = Some(3);
15     //~^ ERROR mismatched types
16
17     let _: Option<(i32,)> = Some((3));
18     //~^ ERROR mismatched types
19
20     two_ints(1, 2); //~ ERROR function takes 1 argument
21
22     with_generic(3, 4); //~ ERROR function takes 1 argument
23 }
24
25 fn two_ints(_: (i32, i32)) {
26 }
27
28 fn with_generic<T: Copy + Send>((a, b): (i32, T)) {
29     if false {
30         // test generics/bound handling
31         with_generic(a, b); //~ ERROR function takes 1 argument
32     }
33 }