Skip to content

--check silently ignored when formatting from stdin #3871

@pyrrho

Description

@pyrrho

When I run,

echo '
fn   foo (   ) {
    fake_fn("this is fine");
    fake_fn   ( "This not so much"    )    ;
}
' | rustfmt --check

the output is equivalent to rustfmt --emit stdout. Ideally, I would like to see the above call emit something like,

Diff in 'stdin' at line 1:
-fn   foo (   ) {
+fn foo() {
     fake_fn("this is fine");
-    fake_fn   ( "This not so much"    )    ;
+    fake_fn("This not so much");
 }

If that's not possible, a warning or error message noting the ignored option would make this behavior less surprising, and may help nudge users towards valid usage.

It might also be worth noting that rustfmt +nightly --emit json is silently ignored in the same situations.

$ rustfmt --version
rustfmt 1.4.4-stable (0462008d 2019-08-06)
$ rustfmt +nightly --version
rustfmt 1.4.9-nightly (33e36670 2019-10-07)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions