rustfmt
rustfmt copied to clipboard
Handle comments between Trait Generics and Bounds
Add handling of comments between Trait Generics and Bounds by using rewrite_assign_rhs_with_comments() (one of the cases identified in #4626 discussion).
Also added workaround for an issue that a comment before the Ident caused code duplication. The workaround is to use the original code in this case.
The PR also partly enhance the resolution of #2055.
Thanks for the updates! I may have a very minor nit or two as a final review pass, but I think we're otherwise in good shape.
I want to think on this a bit longer to make sure we're not overlooking any scenarios. In cases like these it's possible that folks may feel like after upgrading rustfmt that it is "changed" its formatting, but really rustfmt is just finally able to format these trait/comment scenarios. It's definitely a fix we want/need, but it's one we need to be sure we've got right/fully covered up front (because we'll be limited in our ability to change it afterwards)