Skip to content

wrong line length calculation #1447

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

Closed
Dushistov opened this issue Apr 11, 2017 · 2 comments
Closed

wrong line length calculation #1447

Dushistov opened this issue Apr 11, 2017 · 2 comments

Comments

@Dushistov
Copy link

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.

@stanislav-tkach
Copy link
Contributor

I have run into this problem too and it's quite annoying.

@nrc
Copy link
Member

nrc commented May 1, 2017

dup of #6 (sorry, this is really important to fix and it has taken forever)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants