Skip to content

rustfmt ignores #![rustfmt::skip] when run with -r #4206

@topecongiro

Description

@topecongiro

Given the following project structure,

.
├── Cargo.lock
├── Cargo.toml
└── src
    ├── foo.rs
    └── main.rs
// main.rs
mod foo;

fn main() {
    println!("Hello, world!");
}
// foo.rs
#![rustfmt::skip]

fn
foo()
{}

rustfmt src/main.rs -c and rustfmt src/foo.rs -c succeeds but rustfmt -cr src/main.rs will fail with the following output:

Diff in /tmp/skip/src/foo.rs:1:
 #![rustfmt::skip]
 
-fn
-foo()
-{}
+fn foo() {}
 

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustfmt::skipArea: `rustfmt::skip` tool attributeC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEP-highHigh priority

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions