style: reformat imports granularity to module

Choosing module granularity over item granularity is based on a similar
choice made in the standard library to balance readabilty, with easy to
read diffs.

This saves 2098 lines or about 33% of the lines spent writing imports.
This is beneficial to both human readers who have to scroll past large
import blocks when reading a file as well as codex which shouldn't have
to add as many tokens to its context.

Manual changes to rustfmt.toml, rust-ci.yml, justfile, docs/contributing
and docs/install. The actual format commit is intentionally in a second
commit to make it easier to rebase this PR as main moves (drop the
next commit and re-run cargo +nightly fmt).

Added cargo nightly to the ci and justfile. In theory this is unstable,
but in real world use this tends to hit a problems perhaps once every
6 months. The fix is usually fairly easy (pin a version briefly), and
the problems tend to be fixed pretty quickly.
This commit is contained in:
Josh McKinney
2025-11-05 17:33:16 -08:00
parent 229d18f4d2
commit c67908ba17
5 changed files with 18 additions and 8 deletions
+2 -2
View File
@@ -57,11 +57,11 @@ jobs:
working-directory: codex-rs
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@1.90
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: cargo fmt
run: cargo fmt -- --config imports_granularity=Item --check
run: cargo +nightly fmt --check # nightly for unstable options in rustfmt.toml
- name: Verify codegen for mcp-types
run: ./mcp-types/check_lib_rs.py