Skip to content

Large match expression not formatted + "Can't set some features ..." errors #2188

Closed
@osa1

Description

@osa1

I have a file with a large match expression. When I run rustfmt on it I see two things

First it prints these warnings:

$ rustfmt src/msg_handler.rs
Warning: can't set some features as unstable features are only available in nightly channel.
Warning: can't set some features as unstable features are only available in nightly channel.
Warning: can't set some features as unstable features are only available in nightly channel.
Warning: can't set some features as unstable features are only available in nightly channel.

I have no idea what are these saying. Which features are not set? Why does it need to set features? I'm using nightly so I don't understand why it's complaining about not using nightly channel.

Second, it doesn't format the file match expression, skipping 367 lines of code.

This used to work until I updated rustfmt today. I tried both rustfmt-nightly package and cargo install --git.

Note that this match expression doesn't have too deeply nested expressions or statements, it just has too many alternatives. There's really nothing wrong with this expression and it should be formatted by rustfmt.

(Somewhat related is we format machine-generated code with rustfmt so if for some reason by default rustfmt won't format large expressions it should at least a flag to disable such size checks)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions