Skip to content

Unicode combining characters cause unnecessary warnings #924

Closed
@euclio

Description

@euclio

On formatting the following code with rustfmt:

fn main() {
    println!("{}", "क्षिक्षिक्षिक्षिक्षिक्षिक्षिक्षिक्षिक्षि");
}

It formats it as:

fn main() {
    println!("{}",
             "क्षिक्षिक्षिक्षिक्षिक्षिक्षिक्षिक्षिक्षि");
}

but outputs: src/lib.rs:3: line exceeded maximum length (sorry), when the line is clearly shorter than the threshold.

I think the problem lies in that rustfmt uses len_utf8() to calculate line length. It should probably use unicode grapheme clusters, but the underlying string buffer type doesn't support this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions