Skip to content

Add bevy fmt. #670

Description

@coolcatcoder

What problem does this solve or what need does it fill?

cargo fmt does not format all rust files in src. It instead formats all modules it can find. If the modules are imported from a macro, then it simply will not format them. Modules imported by a macro can allow for some very powerful techniques that I believe would benefit bevy.

What solution would you like?

A bevy fmt would run rustfmt individually on each rust file in src.

What alternative(s) have you considered?

I have my own cargo please_format, but this behaviour seems useful to more than just me.

Additional context

Some discussion in the discord.

Activity

  1. added
    A-CLIRelated to the main CLI and not a more specific subcommand
    X-ControversialThere is active debate or serious implications around merging this PR
    D-ModestA "normal" level of difficulty; suitable for simple features or challenging fixes
    on Nov 2, 2025
  2. BD103 commented on Nov 2, 2025

    @BD103
    Member

    Personally, I'm very hesitant to introduce a feature like this because the core Bevy engine doesn't use macro-generated mod statements. This style of code feels niche and a little out-of-scope for the CLI, although I'm curious to hear what others think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-CLIRelated to the main CLI and not a more specific subcommandC-FeatureMake something new possibleD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesX-ControversialThere is active debate or serious implications around merging this PR

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions