]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/target/comment-not-disappear.rs
Auto merge of #83342 - Count-Count:win-console-incomplete-utf8, r=m-ou-se
[rust.git] / src / tools / rustfmt / tests / target / comment-not-disappear.rs
1 // All the comments here should not disappear.
2
3 fn a() {
4     match x {
5         X |
6         // A comment
7         Y => {}
8     };
9 }
10
11 fn b() {
12     match x {
13         X =>
14         // A comment
15         {
16             y
17         }
18     }
19 }
20
21 fn c() {
22     a() /* ... */;
23 }
24
25 fn foo() -> Vec<i32> {
26     (0..11)
27         .map(|x|
28         // This comment disappears.
29         if x % 2 == 0 { x } else { x * 2 })
30         .collect()
31 }
32
33 fn calc_page_len(prefix_len: usize, sofar: usize) -> usize {
34     2 // page type and flags
35     + 1 // stored depth
36     + 2 // stored count
37     + prefix_len + sofar // sum of size of all the actual items
38 }