Skip to content

Add rustfmt.toml for consistent code formatting #114

@Priyanshu-rgbb

Description

@Priyanshu-rgbb

Description

The repository requires contributors to run cargo fmt (per CONTRIBUTING.md) but doesn't provide a rustfmt.toml configuration file to enforce project-specific formatting rules

Why this matters

  • Without explicit configuration, different contributors might have different rustfmt versions/defaults
  • Enforces consistent import organization, line length, and style
  • Reduces "formatting noise" in PRs where different rustfmt settings produce different output
  • Documents the project's formatting preferences

Files Affected

Create rustcloud/rustfmt.toml

Acceptance Criteria:

  • Create rustcloud/rustfmt.toml in the crate directory
  • Set edition to "2021" (matches Cargo.toml)
  • Configure sensible defaults for line length, imports, etc.
  • Run cargo fmt after adding the config to verify no unexpected mass changes
  • Document any non-standard choices with inline comments

Proposed Implementation

Rust formatting configuration for RustCloud

edition = "2021"

Code layout

max_width = 100
hard_tabs = false
tab_spaces = 4

Imports

imports_granularity = "Crate"
group_imports = "StdExternalCrate"

Comments

wrap_comments = true
comment_width = 100

Consistency

newline_style = "Unix"

Additional Context

After merging, contributors should run cargo fmt to update their local code. This may produce a one-time large formatting diff—recommend running in a separate "format all" commit if needed.

See rustfmt documentation: https://rust-lang.github.io/rustfmt/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions