rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

Handle comments between Trait Generics and Bounds

Open davidBar-On opened this issue 4 years ago • 1 comments

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.

davidBar-On avatar Jan 22 '21 11:01 davidBar-On

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)

calebcartwright avatar Apr 02 '21 02:04 calebcartwright