Skip to content

Enforce module import formatting#503

Merged
ctz merged 1 commit into
rustls:mainfrom
xyzzyz:codex/enforce-module-imports
Jun 3, 2026
Merged

Enforce module import formatting#503
ctz merged 1 commit into
rustls:mainfrom
xyzzyz:codex/enforce-module-imports

Conversation

@xyzzyz
Copy link
Copy Markdown
Contributor

@xyzzyz xyzzyz commented Jun 3, 2026

I did not add it to rustfmt.toml, as it requires nightly toolchain. Instead, it's enforced on CI only.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.68%. Comparing base (ce0d2e1) to head (690b1c1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #503   +/-   ##
=======================================
  Coverage   97.68%   97.68%           
=======================================
  Files          20       20           
  Lines        3971     3971           
=======================================
  Hits         3879     3879           
  Misses         92       92           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ctz
Copy link
Copy Markdown
Member

ctz commented Jun 3, 2026

How about following the arrangement in the rustls repo, to summarise:

  • have a .rustfmt.unstable.toml in repo root, which would contain:
group_imports = "StdExternalCrate"
imports_granularity = "Module"
  • optionally, have a .cargo/config.toml which contains:
[alias]
fmt-unstable = ["fmt", "--", "--config-path", ".rustfmt.unstable.toml"]

CI runs both cargo +stable fmt --check and cargo +nightly fmt-unstable --check and fails on either. Failure on the nightly one advises "Nightly formatting check failed. Please run cargo +nightly fmt-unstable"

@ctz
Copy link
Copy Markdown
Member

ctz commented Jun 3, 2026

Actually, I'll do a follow-up

@ctz ctz added this pull request to the merge queue Jun 3, 2026
Merged via the queue into rustls:main with commit 9f42d4b Jun 3, 2026
23 checks passed
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.

4 participants