I tried this code:
// main.rs
mod bar;
fn main() {
bar::foo();
}
// bar.rs
#![rustfmt::skip]
pub fn foo() { println!("unformatted") }
I expected to see this happen: No warnings and bar.rs will not get formatted by cargo fmt.
Instead, this happened: cargo build emits a warning, bar.rs is correctly not formatted by cargo fmt.
warning: unused attribute
--> src/bar.rs:1:1
|
1 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_attributes)]` on by default
While trying to minimize I changed mod bar to be an inline module, but that hits the unstable custom_inner_attributes feature (#54726). So maybe rustfmt shouldn't be obeying this attribute? Either way there's an inconsistency here with whether rustc or rustfmt believe the attribute is active or not.
Meta
rustc --version --verbose:
rustc 1.50.0-nightly (0f6f2d681 2020-12-06)
binary: rustc
commit-hash: 0f6f2d681b39c5f95459cd09cb936b6ceb27cd82
commit-date: 2020-12-06
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly
I tried this code:
I expected to see this happen: No warnings and
bar.rswill not get formatted bycargo fmt.Instead, this happened:
cargo buildemits a warning,bar.rsis correctly not formatted bycargo fmt.While trying to minimize I changed
mod barto be an inline module, but that hits the unstablecustom_inner_attributesfeature (#54726). So mayberustfmtshouldn't be obeying this attribute? Either way there's an inconsistency here with whetherrustcorrustfmtbelieve the attribute is active or not.Meta
rustc --version --verbose: