]> git.lizzy.rs Git - rust.git/blob - tests/ui/unit_arg.rs
Adapt the *.stderr files of the ui-tests to the tool_lints
[rust.git] / tests / ui / unit_arg.rs
1 #![feature(tool_lints)]
2
3 #![warn(clippy::unit_arg)]
4 #![allow(clippy::no_effect)]
5
6 use std::fmt::Debug;
7
8 fn foo<T: Debug>(t: T) {
9     println!("{:?}", t);
10 }
11
12 fn foo3<T1: Debug, T2: Debug, T3: Debug>(t1: T1, t2: T2, t3: T3) {
13     println!("{:?}, {:?}, {:?}", t1, t2, t3);
14 }
15
16 struct Bar;
17
18 impl Bar {
19     fn bar<T: Debug>(&self, t: T) {
20         println!("{:?}", t);
21     }
22 }
23
24 fn bad() {
25     foo({});
26     foo({ 1; });
27     foo(foo(1));
28     foo({
29         foo(1);
30         foo(2);
31     });
32     foo3({}, 2, 2);
33     let b = Bar;
34     b.bar({ 1; });
35 }
36
37 fn ok() {
38     foo(());
39     foo(1);
40     foo({ 1 });
41     foo3("a", 3, vec![3]);
42     let b = Bar;
43     b.bar({ 1 });
44     b.bar(());
45     question_mark();
46 }
47
48 fn question_mark() -> Result<(), ()> {
49     Ok(Ok(())?)?;
50     Ok(Ok(()))??;
51     Ok(())
52 }
53
54 fn main() {
55     bad();
56     ok();
57 }