Skip to content

wrong line length calculation #1447

Closed
Closed
@Dushistov

Description

@Dushistov

If I run:

$ rustfmt --version
0.8.3 ()

with such code:

fn test() -> Result<i32, String> {
    let r: Result<i32, String> = Ok(17);
    r.map_err(|err| format!("Someting really, really wrong, may be flash in the sun  : {}", err))?;
    Ok(15)
}

rustfmt works without problem, but if I place the same amount of chars (not bytes) into line:

fn test() -> Result<i32, String> {
    let r: Result<i32, String> = Ok(17);
    r.map_err(|err| format!("Что-то пошло совсем не так, может быть вспышка на солнце: {}", err))?;
    Ok(15)
}

it reports error: line exceeded maximum length (maximum: 100, found: 144) (sorry)

rustfmt should work with chars, not bytes, because of editors/code review tools and so on,
display both code examples using the same amount of horizontal space.

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