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

ctz merged 1 commit into
rustls:mainfrom
xyzzyz:codex/enforce-module-imports

Conversation

@xyzzyz

@xyzzyz xyzzyz commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

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

ctz commented Jun 3, 2026

Copy link
Copy Markdown
Member

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

ctz commented Jun 3, 2026

Copy link
Copy Markdown
Member

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