Skip to content

Ensure rustfmt is invoked without edition parameter #571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2025

Conversation

apiraino
Copy link
Contributor

@apiraino apiraino commented Jun 18, 2025

Fixes #570

rustfmt should probably be invoked without defaulting to any --edition parameter as it collides with a user configuration in a rustfmt.toml or with the rustfmt default (2015 edition at the time of this patch).

This patch sets rust-rustfmt-switches to nil so in a sense, I think this could be a breaking change?

I've added a test to ensure that it stays so. The test is a bit flaky, it doesn't use a rutfmt.toml so it's not completely isolated. But I'm an Emacs newbie, so 🤷

Happy to receive feedback. Thanks for the review!

r? @psibi

@apiraino apiraino force-pushed the rustfmt-2018-edition-default branch from 6873c6f to b902906 Compare June 18, 2025 20:50
@apiraino apiraino marked this pull request as ready for review June 18, 2025 20:50
@rustbot
Copy link

rustbot commented Jun 18, 2025

Failed to set assignee to psibi: cannot assign: response: {"message":"Must have admin rights to Repository.","documentation_url":"https://docs.github.com/rest/issues/assignees#add-assignees-to-an-issue","status":"403"}

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@apiraino apiraino force-pushed the rustfmt-2018-edition-default branch 2 times, most recently from 636039f to 0a5c8f5 Compare June 18, 2025 20:53
Copy link
Member

@psibi psibi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM apart from minor comments, I like the tests!

@apiraino apiraino force-pushed the rustfmt-2018-edition-default branch 5 times, most recently from d617d50 to fcab951 Compare June 20, 2025 07:16
@psibi
Copy link
Member

psibi commented Jun 20, 2025

@apiraino Missed this, one more change: Can you also update the changelog: https://github.com/rust-lang/rust-mode/blob/master/Changelog.md ?

@apiraino
Copy link
Contributor Author

@apiraino Missed this, one more change: Can you also update the changelog: master/Changelog.md ?

One more thing about this change. As I mentioned in the opening comment, do you think this qualifies as a breaking change for users? I mean, people could start seeing their code being formatted differently. If I understand how MELPA publishing works, this commit will be automatically picked up by them once merged, correct?

Do you do some tagging/releases for other package repositories that don't stay on top of trunk commits - like Elpa?

@apiraino apiraino force-pushed the rustfmt-2018-edition-default branch from fcab951 to 485d97f Compare June 20, 2025 07:45
@psibi
Copy link
Member

psibi commented Jun 20, 2025

@apiraino

do you think this qualifies as a breaking change for users?

Yes

If I understand how MELPA publishing works, this commit will be automatically picked up by them once merged, correct?

Yes. Although Melpa stable won't. Although very few people actually use MELPA stable.

Do you do some tagging/releases for other package repositories that don't stay on top of trunk commits - like Elpa?

We do it. Although we wait for quite a bit and for lots of change to accumulate. The last release was done a year ago because we want to release support with tree-sitter: https://github.com/rust-lang/rust-mode/releases/tag/1.0.6

@psibi psibi merged commit 8cfcdd1 into rust-lang:master Jun 20, 2025
16 checks passed
@apiraino apiraino deleted the rustfmt-2018-edition-default branch June 20, 2025 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustfmt invoked without considering rustfmt.toml
5 participants