]> git.proxmox.com Git - rustc.git/blame - src/tools/rustfmt/tests/target/skip.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / rustfmt / tests / target / skip.rs
CommitLineData
f20569fa
XL
1// Test the skip attribute works
2
3#[rustfmt::skip]
4fn foo() { badly; formatted; stuff
5; }
6
7#[rustfmt::skip]
8trait Foo
9{
10fn foo(
11);
12}
13
14impl LateLintPass for UsedUnderscoreBinding {
15 #[cfg_attr(rustfmt, rustfmt::skip)]
16 fn check_expr() { // comment
17 }
18}
19
20fn 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
33fn 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)]
86fn
87main() {}