For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/cli/fmt.md.
  • English
  • fmt

    The rs fmt command formats files or checks whether they are formatted. For detailed usage, see Formatting.

    Usage

    rs fmt [options] [files/globs...]

    Pass files, directories, or glob patterns to choose what to format. When no paths are provided, rs fmt formats the current directory.

    Examples:

    # Format files in the current directory
    rs fmt
    
    # Format specific files and directories
    rs fmt src package.json
    
    # Check formatting in CI
    rs fmt --check

    rs format is an alias for rs fmt:

    rs format

    Options

    OptionDescription
    --writeWrite formatted files in place. This is the default mode.
    --checkCheck formatting without writing files. Exits with code 1 when files are different.
    --list-differentPrint only unformatted paths. Exits with code 1 when files are different.
    --parallel-workers <count>Set the maximum number of formatting workers.
    -h, --helpDisplay usage and option information.

    --write, --check, and --list-different are mutually exclusive.