Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustfmt misaligns comments #4151

Closed
AlyoshaVasilieva opened this issue May 1, 2020 · 0 comments · Fixed by #4171
Closed

Rustfmt misaligns comments #4151

AlyoshaVasilieva opened this issue May 1, 2020 · 0 comments · Fixed by #4171

Comments

@AlyoshaVasilieva
Copy link

fn main() {
    let mappings = [
        (0b1110_0011, 'ε'),
        (0b1110_0100, 'μ'), // micro
        (0b1110_0101, 'σ'),
        (0b1110_0110, 'ρ'),
        (0b1110_0111, 'ɡ'), // Questionable: IPA voiced velar stop? Or is it math?
        (0b1110_1000, '√'), // sqrt
        (0b1110_1001, ' '),  // Non-Unicode: exponent -1
        (0b1110_1010, ' '),  // Very tall 'j'; non-Unicode? Can't display on my LCD anyway (TESTME)
        (0b1110_1011, ' '),
        (0b1110_1100, '¢'), // cent sign
        (0b1110_1101, '£'), // pound sign
    ];
}

Rustfmt causes two of these comments to be misaligned. Removing // Questionable: IPA voiced velar stop? Or is it math? causes the two misaligned lines be even more misaligned upon another run of rustfmt (via cargo fmt). Then removing // sqrt causes both lines to resume normal alignment.

Tested with Rust 1.43 stable (rustfmt 1.4.12-stable (a828ffea 2020-03-11)) and Rust nightly (rustfmt 1.4.14-nightly (a5cb5d26 2020-04-14))

ayazhafiz added a commit to ayazhafiz/rustfmt that referenced this issue May 10, 2020
For an end user, the number of characters in a string is most likely
interpreted as the number of [grapheme cluster](http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries)s in the string,
which may be different than either the number of unicode codepoints or
bytes. Use the number of graphemes to determine list comment alignment
rather than the byte length of the line.

Closes rust-lang#4151
topecongiro added a commit that referenced this issue May 12, 2020
For an end user, the number of characters in a string is most likely
interpreted as the number of [grapheme cluster](http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries)s in the string,
which may be different than either the number of unicode codepoints or
bytes. Use the number of graphemes to determine list comment alignment
rather than the byte length of the line.

Closes #4151
bradleypmartin pushed a commit to bradleypmartin/rustfmt that referenced this issue May 25, 2020
For an end user, the number of characters in a string is most likely
interpreted as the number of [grapheme cluster](http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries)s in the string,
which may be different than either the number of unicode codepoints or
bytes. Use the number of graphemes to determine list comment alignment
rather than the byte length of the line.

Closes rust-lang#4151
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants