Skip to content

Inconsistent Formatting with non-ASCII characters #3574

Closed
@JP-Ellis

Description

@JP-Ellis

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions