Rustfmt: Global skip attribute is ignored

Created on 22 Jul 2020  路  1Comment  路  Source: rust-lang/rustfmt

Describe the bug

It seems that #![rustfmt::skip] is ignored. I'm not sure if this attribute is broken completely, but I was able to reduce code to the minimum and rustfmt still formats the code. Originally I encountered this issue in the rust-protobuf project where generated files contain the global skip attribute: https://github.com/stepancheg/rust-protobuf/pull/511

To Reproduce
Run cargo fmt for the following code:

#![rustfmt::skip]

#[derive(PartialEq,Clone,Default)]
pub struct TestMessage {
}

Expected behavior

I expect no changes after cargo fmt and no output after the cargo fmt -- --check command.

Meta

  • rustfmt version: rustfmt 1.4.15-stable (530eadf 2020-06-02)
  • From where did you install rustfmt?: rustup
  • How do you run rustfmt: cargo fmt
bug

Most helpful comment

Thank you for filing an issue. The issue is fixed in the latest development branch and the nightly channel, but unfortunately, the latest stable channel missed the fix.

The rustup release team will backport the fix; please follow this issue to track the progress.

>All comments

Thank you for filing an issue. The issue is fixed in the latest development branch and the nightly channel, but unfortunately, the latest stable channel missed the fix.

The rustup release team will backport the fix; please follow this issue to track the progress.

Was this page helpful?
0 / 5 - 0 ratings