diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/tools/rustfmt/tests/target/comments-fn.rs | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/rustfmt/tests/target/comments-fn.rs')
-rw-r--r-- | src/tools/rustfmt/tests/target/comments-fn.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/target/comments-fn.rs b/src/tools/rustfmt/tests/target/comments-fn.rs new file mode 100644 index 000000000..1f43bd93b --- /dev/null +++ b/src/tools/rustfmt/tests/target/comments-fn.rs @@ -0,0 +1,38 @@ +// Test comments on functions are preserved. + +// Comment on foo. +fn foo<F, G>( + a: aaaaaaaaaaaaa, // A comment + b: bbbbbbbbbbbbb, // a second comment + c: ccccccccccccc, + // Newline comment + d: ddddddddddddd, + // A multi line comment + // between args. + e: eeeeeeeeeeeee, /* comment before paren */ +) -> bar +where + F: Foo, // COmment after where-clause + G: Goo, // final comment +{ +} + +fn bar<F /* comment on F */, G /* comment on G */>() {} + +fn baz() -> Baz /* Comment after return type */ {} + +fn some_fn<T>() +where + T: Eq, // some comment +{ +} + +fn issue458<F>(a: &str, f: F) +// comment1 +where + // comment2 + F: FnOnce(&str) -> bool, +{ + f(a); + () +} |