rust-lang / rustfmt

Format Rust code
https://rust-lang.github.io/rustfmt/
Apache License 2.0
6.06k stars 892 forks source link

Add style_edition 2027 #6324

Closed johnhuichen closed 2 months ago

ytmimi commented 2 months ago

@johnhuichen Thanks for getting the ball rolling on this one. I think it would be best to keep this PR focused on just style_edition instead of also updating edition. As you noted, rustc hasn't provided a 2027 variant yet, but rustfmt will need an unstable StyleEdition::Edition2027 for future breaking formatting changes that aren't stabilized StyleEdition::Edition2024. Correct me if I'm wrong, but we only ever convert from Edition -> StyleEdition and not the other way around so I think that should be fine.

johnhuichen commented 2 months ago

@johnhuichen Thanks for getting the ball rolling on this one. I think it would be best to keep this PR focused on just style_edition instead of also updating edition. As you noted, rustc hasn't provided a 2027 variant yet, but rustfmt will need an unstable StyleEdition::Edition2027 for future breaking formatting changes that aren't stabilized StyleEdition::Edition2024. Correct me if I'm wrong, but we only ever convert from Edition -> StyleEdition and not the other way around so I think that should be fine.

Sounds good, I can take another look

johnhuichen commented 2 months ago

@ytmimi I am a little tied up for the next couple of weeks, and won't be able to make too much progress with rustfmt. Let me know if the delay is alright with you, or if it's better if I unassigned myself from the tasks

ytmimi commented 2 months ago

Thanks for the heads up! I don't think it should be an issue, but if the urgency around this changes we can open an alternative PR or build off of what you've got here.

ytmimi commented 2 months ago

Also, just a small note: The team discourages merge commits so in the future please rebase your changes when getting your branch up to date.

johnhuichen commented 2 months ago

@ytmimi I removed Edition::Edition2027 everywhere. Let me know if there is any other code changes where I need to make to add StylEdition2027

fyi: I am keeping intermediate commits so it's easier for you to see what changes I made since last time. Before merging I will rebase everything to 1 commit

johnhuichen commented 2 months ago

Things looks good. Just want to add comments to the various places where 2027 defaults to 2024.

I just added comments as requested