Skip to content

Consider switching to tab-based indenting in new Rust edition #3003

Closed
@clarfonthey

Description

@clarfonthey

Right now, Rust's standard formatting suggestion is four-space indentations. However, there are multiple reasons why tabs may be more accessible, including:

  • Some (potentially common) screen-reader configurations may read out multiple spaces instead of as individual units
  • Tabs are easily configurable for folks who need larger or smaller indentations for a variety of reasons
  • Probably others I haven't thought of

There already are standard ways (e.g. editorconfig) to make tabs display as a set number of spaces in editors, and switching to using tabs by default would improve the accessibility of Rust as a whole. So, we could still set a recommended size for tabs to be displayed as four spaces, while still preferring the use of tab characters in files.

Note that this would simply be the default suggestion, and folks can still use spaces if they prefer. And because of the stability guarantees of rustfmt, it would have to be done with an edition bump, which is potentially coming up in 2021.

One of the biggest arguments against using spaces instead of tabs is the ability to do visual alignment, which is actually suggested against in the default Rust guidelines. Since Rust is already essentially using four spaces in the same way as tab characters, I think it would make sense to switch to tabs as a whole for continuing one of Rust's core goals of accessibility.

Note: as clarified in a few comments here, whatever happens should be the result of working with folks who use assistive technology (screen readers, braille readers, font scaling, etc.) and seeing what is most accessible to them. However, I have a feeling that tabs will ultimately win out as they're much more easily configurable. The whole point is to heavily consider the option of switching to tabs, not simply assume that either that solution or the status quo is best for everyone.

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