Skip to content

--file-lines (range formatting) seems to be broken in a couple of ways #1835

@sunshowers

Description

@sunshowers

Hey -- I'm trying to integrate RLS and rustfmt with our IDE, and it looks like range formatting is broken in a couple of ways. Here's a repro with 19bd5ea, with these settings:

condense_wildcard_suffixes = true
reorder_imported_names = true
reorder_imports = true
reorder_imports_in_group = true
use_try_shorthand = true
  1. Download lz4.rs from this gist somewhere.
  2. rustfmt lz4.rs --file-lines '[{"file": "lz4.rs", "range": [20, 27]}]' --write-mode display
  3. What you get back looks like lz4_output.rs.

Note a couple of things:

  1. Imports were reordered even though none of the imports were in the range.
  2. Line 32 got formatted even though it isn't in the range.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEP-highHigh priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions