rustfmt
rustfmt copied to clipboard
Handling fn empty where and comments after return type
Proposed fix for issue #5407. Although the original issue is about fn empty where clause indentation, the issue is actually about handling of comments after fn return type. This is because with current code the empty where was handled as a post return type comment.
In addition, there are related issues with handling comments for fn empty where clause without return type. Therefore the fix handles the cases of fn return type without where clause, empty where clause without return type, and return type with empty where clause.
The proposed fix seem to also resolve issue #4649.
Note that the fix is not related to issues with traits empty where clause, such as #4672.
Thanks for your work on this! I Also appreciate you linking some relevant issues. I'm planning to get an initial review done in the next few days
The proposed fix seem to also resolve issue https://github.com/rust-lang/rustfmt/issues/4649.
Could we add test cases for the linked issue if these changes help to resolve what's going on there
The proposed fix seem to also resolve issue https://github.com/rust-lang/rustfmt/issues/4649.
Could we add test cases for the linked issue if these changes help to resolve what's going on there
Added test cases for the original case of #4649 with empty where.
The other reported case in #4649 with non-empty where is a different issue and is probably the same issue as reported in #4672.
Added test cases for the https://github.com/rust-lang/rustfmt/issues/4649#issue-787737841 of https://github.com/rust-lang/rustfmt/issues/4649 with empty where.
The https://github.com/rust-lang/rustfmt/issues/4649#issuecomment-952310029 in https://github.com/rust-lang/rustfmt/issues/4649 with non-empty where is a different issue and is probably the same issue as reported in https://github.com/rust-lang/rustfmt/issues/4672.
Thank you for looking into this!