Skip to content

Comments in match partially aligned when using hard_tabs #6796

@ginnyTheCat

Description

@ginnyTheCat

When using the hard_tabs option the last two comments are aligned, but none of the previous ones:

fn year_path(year: u16) -> Option<&'static str> {
	Some(match year {
		2020.. => "Current", // https://www.indianamap.org/datasets/INMap::indiana-current-imagery/about
		2016.. => "2016_2019", // https://www.indianamap.org/datasets/INMap::indiana-2016-2019-imagery/about
		2011.. => "2011_2013", // https://www.indianamap.org/datasets/INMap::indiana-imagery-2011-2013/about
		2005.. => "2005",      // https://www.indianamap.org/datasets/INMap::indiana-2005-imagery/about
		_ => return None,
	})
}

Adding a character in "2011_2013" causes the comment in the line below to also move one space to the right. Adding two more characters to the string however causes this "bond" to break.

Disabling the hard_tabs option causes the formatting to be more consistent again:

fn year_path(year: u16) -> Option<&'static str> {
    Some(match year {
        2020.. => "Current", // https://www.indianamap.org/datasets/INMap::indiana-current-imagery/about
        2016.. => "2016_2019", // https://www.indianamap.org/datasets/INMap::indiana-2016-2019-imagery/about
        2011.. => "2011_2013", // https://www.indianamap.org/datasets/INMap::indiana-imagery-2011-2013/about
        2005.. => "2005", // https://www.indianamap.org/datasets/INMap::indiana-2005-imagery/about
        _ => return None,
    })
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-commentsArea: commentsneeds-triageThis issue or PR needs triaging to determine its status. Remove label once sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions