Closed
Description
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.