Skip to content

Indentation in macros is handled oddly #4611

Closed
@delbonis

Description

@delbonis

Input

    tokio::select! {
	result = reader => {
            match result {
		Ok(v) => {
		    eprintln!(
                    "message: {}",
                    v
                    );
                },
		Err(_) => {
		    eprintln!(
                        "error: {}",
                        e
                    );
                },
            }
	},
	_ = writer => {
            // Comment
            eprintln!(
                "completed: {}",
                some_other_field
            );
	}
    }

This is basically what company-mode gives us. I edited it slightly from the actual code but preserved the indentation.

Output

    tokio::select! {
    result = reader => {
            match result {
        Ok(v) => {
            eprintln!(
            "message: {}",
            v
            );
        },
        Err(e) => {
            eprintln!(
            "error: {}",
            e
            );
        }
            }
    },
    _ = writer => {
            // Comment
            eprintln!(
                "completed: {}",
                some_other_field
            );
    }
    }

Expected output

Something that resembles the input.

Meta

  • rustfmt version: rustfmt 1.4.30-nightly (acd9486 2020-12-20)
  • From where did you install rustfmt?: rustup

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions