Skip to content

Improve formatting of ranges whose start/end contain binary operators #204

@joshtriplett

Description

@joshtriplett

An example:

count_hash + 2..s.len() - count_hash - 1

The spacing is confusing and doesn't match the precedence.

I think we should format this like:

(count_hash + 2)..(s.len() - count_hash - 1)

Note that I only think we should parenthesize endpoints when needed for clarity, so for instance:

count_hash..(s.len() - count_hash - 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions