Skip to content

Inconsistent Formatting with non-ASCII characters #3574

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
JP-Ellis opened this issue May 21, 2019 · 1 comment · Fixed by #3618
Closed

Inconsistent Formatting with non-ASCII characters #3574

JP-Ellis opened this issue May 21, 2019 · 1 comment · Fixed by #3618

Comments

@JP-Ellis
Copy link

It appears that rustfmt does not always format essentially identical lines the same, and in this case the only difference is that one line has only ASCII characters, while the other has non-ASCII characters. The specific example I have (after formatting):

pub fn foo(config: &Config) {
    let csv = RefCell::new(create_csv(config, "foo"));
    {
        let mut csv = csv.borrow_mut();
        for (i1, i2, i3) in iproduct!(0..2, 0..3, 0..3) {
            csv.write_field(format!("γ[{}.{}.{}]", i1, i2, i3))
                .unwrap();
            csv.write_field(format!("d[{}.{}.{}]", i1, i2, i3)).unwrap();
            csv.write_field(format!("i[{}.{}.{}]", i1, i2, i3)).unwrap();
        }
        csv.write_record(None::<&[u8]>).unwrap();
    }

where each line within the iproduct! loop should be identical as they are all exactly the same length; however, the line with the γ letter is formatted differently to the other two.

Note I am using rustfmt 1.0.3-stable (d6829d6 2019-02-14)

@scampi
Copy link
Contributor

scampi commented May 24, 2019

Another issue that seems related #3235 it had a PR but looks like it missed some cases!

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.

3 participants