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

Initiate configuration of rustfmt #374

Merged
merged 5 commits into from
May 10, 2022
Merged

Commits on May 10, 2022

  1. Use term fmt instead of lint

    We only run the formatter (`cargo fmt`) not the linter (`cargo clippy`).
    Use the appropriate term in the test script and the CI configuration.
    tcharding committed May 10, 2022
    Configuration menu
    Copy the full SHA
    8d0c69a View commit details
    Browse the repository at this point in the history
  2. Run cargo fmt with nightly toolchain

    Running `rustfmt` with the nightly toolchain allows us to use unstable
    options. Users can still run it with the stable toolchain locally and
    ignore the warnings.
    tcharding committed May 10, 2022
    Configuration menu
    Copy the full SHA
    f7f6f3b View commit details
    Browse the repository at this point in the history
  3. Add rustfmt configuration file

    Generate and add a default configuration file for `rustfmt` using
    
     rustfmt --print-config default rustfmt.toml
    
    This produces a config file that causes `rustfmt` to make no changes, as
    expected, when we run
    
     cargo +nightly fmt
    
    Please note, the config file includes unstable options which throw
    warnings if used without the nightly toolchain.
    tcharding committed May 10, 2022
    Configuration menu
    Copy the full SHA
    ccdef6f View commit details
    Browse the repository at this point in the history
  4. Configure group_imports

    Configure `group_imports = "StdExternalCrate"`.
    
    The benefit of this option is that it increases uniformity in the code
    base over the default "Preserve", while saving devs needing to think
    about where they place their import statements (for those that do not
    use tooling to add them).
    tcharding committed May 10, 2022
    Configuration menu
    Copy the full SHA
    a89edba View commit details
    Browse the repository at this point in the history
  5. Configure imports_granularity

    Configure `imports_granularity = "Module"`.
    
    The benefit of this option is that it increases uniformity in the code
    base over the default "Preserve" and also, from my personal experience,
    it tends to reduce the noise in diffs from adding/removing imports.
    tcharding committed May 10, 2022
    Configuration menu
    Copy the full SHA
    8062016 View commit details
    Browse the repository at this point in the history