]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/target/comments-fn.rs
Merge commit '39683d8eb7a32a74bea96ecbf1e87675d3338506' into sync_cg_gcc-2022-03-26
[rust.git] / src / tools / rustfmt / tests / target / comments-fn.rs
1 // Test comments on functions are preserved.
2
3 // Comment on foo.
4 fn foo<F, G>(
5     a: aaaaaaaaaaaaa, // A comment
6     b: bbbbbbbbbbbbb, // a second comment
7     c: ccccccccccccc,
8     // Newline comment
9     d: ddddddddddddd,
10     //  A multi line comment
11     // between args.
12     e: eeeeeeeeeeeee, /* comment before paren */
13 ) -> bar
14 where
15     F: Foo, // COmment after where-clause
16     G: Goo, // final comment
17 {
18 }
19
20 fn bar<F /* comment on F */, G /* comment on G */>() {}
21
22 fn baz() -> Baz /* Comment after return type */ {}
23
24 fn some_fn<T>()
25 where
26     T: Eq, // some comment
27 {
28 }
29
30 fn issue458<F>(a: &str, f: F)
31 // comment1
32 where
33     // comment2
34     F: FnOnce(&str) -> bool,
35 {
36     f(a);
37     ()
38 }