Skip to content
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

Reformat apollo-router crate with rustfmt 2024 edition #6854

Merged
merged 2 commits into from
Mar 3, 2025
Merged

Conversation

SimonSapin
Copy link
Contributor

@SimonSapin SimonSapin commented Feb 24, 2025

Starting with Rust 1.85, the language edition 2024 is available. With it also comes the rustfmt style edition 2024, with several changes to code formatting such as import sorting. By default the style edition matches the language edition, but both can be configured separately. While we cannot use the new language edition yet in the apollo-router crate (GREsau/schemars#376), this PR changes to the new style edition. Aside from apollo-router/rustfmt.toml it is entirely generated by this command matching CI configuration:

cargo +nightly fmt -- --config imports_granularity=Item,group_imports=StdExternalCrate

(Unfortunately, import granularity and grouping config is still unstable in rustfmt.)

@SimonSapin SimonSapin requested review from a team as code owners February 24, 2025 12:21
@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented Feb 24, 2025

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: e8904def6b03cfe1ecabceea

Copy link
Contributor

@SimonSapin, please consider creating a changeset entry in /.changesets/. These instructions describe the process and tooling.

Copy link
Member

@IvanGoncharov IvanGoncharov left a comment

Choose a reason for hiding this comment

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

Not a Rust expert but it make sense to me 👍

Copy link
Member

@abernix abernix left a comment

Choose a reason for hiding this comment

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

I would propose that we:

@SimonSapin
Copy link
Contributor Author

As expected this has conflicts now so I’m gonna:

  • Start over with a new branch from dev
  • Reformat in a first commit
  • Add that commit hash .git-blame-ignore-revs (and 3f62ebe for Upgrade apollo-federation to Rust edition 2024 #6839) in a second commit
  • Force-push to this PR
  • True-merge it before it conflicts again, based on the spirit of approval of the current diff even though it’ll be a different diff

Starting with Rust 1.85, the language edition 2024 is available.
With it also comes the [rustfmt style edition 2024](https://doc.rust-lang.org/edition-guide/rust-2024/rustfmt-style-edition.html),
with several changes to code formatting such as import sorting.
By default the style edition matches the language edition, but both can be configured separately.
While we cannot use the new language edition yet in the apollo-router crate
(GREsau/schemars#376),
this PR changes to the new style edition.
Aside from `apollo-router/rustfmt.toml` it is entirely generated by this command matching CI configuration:

```
cargo +nightly fmt -- --config imports_granularity=Item,group_imports=StdExternalCrate
```

(Unfortunately, import granularity and grouping config is still unstable in rustfmt.)
@SimonSapin SimonSapin enabled auto-merge March 3, 2025 11:14
@SimonSapin SimonSapin merged commit bd44815 into dev Mar 3, 2025
15 checks passed
@SimonSapin SimonSapin deleted the simon/style24 branch March 3, 2025 11:29
SimonSapin added a commit that referenced this pull request Mar 3, 2025
The schemars blocker is now fixed upstream.
The local changes needed were already done in
#6850 and
#6854.
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.

5 participants