-
Hi everyone! 👋 I stumbled upon a thing that seems a bit odd to me. In a project which targets the stable release of Rust, Is this the expected behaviour, or is there something wrong with my setup/configuration that causes this? 🤔 `cargo clippy` output:
warning: `cfg_attr` is deprecated for rustfmt and got replaced by tool attributes
--> src/scanner.rs:9:1
|
9 | #[cfg_attr(rustfmt, rustfmt_skip)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `#[rustfmt::skip]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#deprecated_cfg_attr
= note: `#[warn(clippy::deprecated_cfg_attr)]` on by default `rustup show` output:
Default host: aarch64-apple-darwin
rustup home: /Users/munchy/.rustup
installed toolchains
--------------------
stable-aarch64-apple-darwin (default)
nightly-aarch64-apple-darwin
installed targets for active toolchain
--------------------------------------
aarch64-apple-darwin
aarch64-unknown-linux-gnu
x86_64-unknown-linux-gnu
active toolchain
----------------
stable-aarch64-apple-darwin (default)
rustc 1.74.0 (79e9716c9 2023-11-13)``` |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Just to be clear, the deprecated attribute still does the job, letting me to skip the automatic formatting for a section of my code, but at the moment, I also need to tell clippy that it's ok to use the deprecated It's fine for now, but I still think it's an odd behaviour on clippy's part, isn't it? 🤔 #[allow(clippy::deprecated_cfg_attr)]
#[cfg_attr(rustfmt, rustfmt_skip)]
static KEYWORDS: Lazy<HashMap<&'static str, TokenType>> = Lazy::new(|| {
HashMap::from([
("and", TokenType::And),
("class", TokenType::Class),
("else", TokenType::Else),
("false", TokenType::False),
("for", TokenType::For),
("fun", TokenType::Fun),
("if", TokenType::If),
("nil", TokenType::Nil),
("or", TokenType::Or),
("print", TokenType::Print),
("return", TokenType::Return),
("super", TokenType::Super),
("this", TokenType::This),
("true", TokenType::True),
("var", TokenType::Var),
("while", TokenType::While),
])
}); |
Beta Was this translation helpful? Give feedback.
-
Tool attributes were stabilized in |
Beta Was this translation helpful? Give feedback.
Tool attributes were stabilized in
1.30
.