]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/target/skip.rs
Merge commit 'd822110d3b5625b9dc80ccc442e06fc3cc851d76' into clippyup
[rust.git] / src / tools / rustfmt / tests / target / skip.rs
1 // Test the skip attribute works
2
3 #[rustfmt::skip]
4 fn foo() { badly; formatted; stuff
5 ; }
6
7 #[rustfmt::skip]
8 trait Foo
9 {
10 fn foo(
11 );
12 }
13
14 impl LateLintPass for UsedUnderscoreBinding {
15     #[cfg_attr(rustfmt, rustfmt::skip)]
16     fn check_expr() { // comment
17     }
18 }
19
20 fn issue1346() {
21     #[cfg_attr(rustfmt, rustfmt::skip)]
22     Box::new(self.inner.call(req).then(move |result| {
23         match result {
24             Ok(resp) => Box::new(future::done(Ok(resp))),
25             Err(e) => {
26                 try_error!(clo_stderr, "{}", e);
27                 Box::new(future::err(e))
28             }
29         }
30     }))
31 }
32
33 fn skip_on_statements() {
34     // Outside block
35     #[rustfmt::skip]
36     {
37         foo; bar;
38             // junk
39     }
40
41     {
42         // Inside block
43         #![rustfmt::skip]
44         foo; bar;
45             // junk
46     }
47
48     // Semi
49     #[cfg_attr(rustfmt, rustfmt::skip)]
50     foo(
51         1, 2, 3, 4,
52         1, 2,
53         1, 2, 3,
54     );
55
56     // Local
57     #[cfg_attr(rustfmt, rustfmt::skip)]
58     let x = foo(  a,   b  ,  c);
59
60     // Item
61     #[cfg_attr(rustfmt, rustfmt::skip)]
62     use foobar;
63
64     // Mac
65     #[cfg_attr(rustfmt, rustfmt::skip)]
66     vec![
67         1, 2, 3, 4,
68         1, 2, 3, 4,
69         1, 2, 3, 4,
70         1, 2, 3,
71         1,
72         1, 2,
73         1,
74     ];
75
76     // Expr
77     #[cfg_attr(rustfmt, rustfmt::skip)]
78     foo(  a,   b  ,  c)
79 }
80
81 // Check that the skip attribute applies to other attributes.
82 #[rustfmt::skip]
83 #[cfg
84 (  a , b
85 )]
86 fn
87 main() {}