Skip to content

Bad hard-tabs handling with blocks in long expressions #6859

@edwloef

Description

@edwloef

Summary

I tried to format this code:

pub fn as_clap(&self) -> TransportEvent {
	TransportEvent {
		flags: TransportFlags::HAS_TEMPO
			| TransportFlags::HAS_BEATS_TIMELINE
			| TransportFlags::HAS_SECONDS_TIMELINE
			| TransportFlags::HAS_TIME_SIGNATURE
			| if self.playing {
				TransportFlags::IS_PLAYING
			} else {
				TransportFlags::empty()
			} | if self.loop_marker.is_some() {
			TransportFlags::IS_LOOP_ACTIVE
		} else {
			TransportFlags::empty()
		},
	}
}

Expected behavior

consistent indentation across the expression

Actual behavior

see above ^^

Configuration

rustfmt configuration file (e.g. rustfmt.toml, if applicable):

hard_tabs = true

This seems to be hard_tabs-reliant, disabling it produces saner output.

Meta

rustfmt --version:

rustfmt 1.8.0-stable

Metadata

Metadata

Labels

A-whitespaceArea: whitespace and its handlingC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-poor-formattingIssue: poor formatting

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions