Skip to content

style: updated rustfmt.toml guidelines - #490

Open
alejandro-vaz wants to merge 3 commits into
servo:v2from
alejandro-vaz:newstyle
Open

style: updated rustfmt.toml guidelines#490
alejandro-vaz wants to merge 3 commits into
servo:v2from
alejandro-vaz:newstyle

Conversation

@alejandro-vaz

@alejandro-vaz alejandro-vaz commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

this PR introduces the following changes to rustfmt.toml:

  1. changes import granularity to one, which means that all imports are grouped under a single use block
  2. cargo fmt --check errors on overflow and unformatted
  3. set one blank line as the maximum
  4. set float literals to only have trailing zeros if they don't have postfix
  5. allowed small functions to be written in a single line of code
  6. set import layout to vertical
  7. automatically convert /* ... */ comments to // ... comments
  8. allowed rustfmt to reorder implementations
  9. prohibited rustfmt to inline simple structs (it hurts readability)
  10. set style edition to 2024
  11. told rustfmt not to introduce trailing commas
  12. suggested rustfmt to prefer ? try shortcut
  13. allowed rustfmt to inline simple where clauses

effects

  • we can no longer use the vec! macro because rustfmt confounds the macro with the module, reducing the imports alloc::vec; alloc::vec::Vec to alloc::vec::{self, Vec} which is not valid
  • at line 2108, not being able to use the vec! macro means that we use iterator-collection specialization instead

@alejandro-vaz
alejandro-vaz requested a review from jdm August 29, 2026 14:19
@alejandro-vaz alejandro-vaz self-assigned this Aug 29, 2026
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.

1 participant