10

dedupe and simplify type alias formatting by calebcartwright · Pull Request #506...

 2 years ago
source link: https://github.com/rust-lang/rustfmt/pull/5068
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Conversation

From my perspective we've got a good chunk of unnecessarily duplicative code handling type alias formatting, and even more generally, visitation of associated items. This not only increases the blast radius when there's relevant upstream changes in rustc, but also created a more difficult mental model for tracking how ty aliases get formatted.

Have been meaning to get around to trying to clean this up, and finally had some bandwidth this morning. This is the first part of a refactor that essentially encapsulates the handling of the TyAliasKind nodes in one place, and allows for a side-by-side view on how the generic bounds and right hand side of aliases are formatted depending on the respective context in which the aliases appear.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK