Open
Description
I'm disabling rustfmt for some lines of my code because I have functions with multiple arguments and for the sake of exposing the logical reasoning of the algorithm, I want to group them on multiple lines. Therefore, I am using:
#[cfg_attr(rustfmt, rustfmt_skip)]
...
Running cargo clippy
tells me:
`cfg_attr` is deprecated for rustfmt and got replaced by tool attributes
...
help: use: `#[rustfmt::skip]`
However, if I replace these with #[rustfmt::skip]
, I'm getting the following error:
error[E0658]: attributes on expressions are experimental
...
note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
I assume it is a bug for a tool in stable Rust to suggest to use an experimental code to replace valid (although deprecated) code.
Meta
rustc --version --verbose
:
rustc 1.53.0 (53cb7b09b 2021-06-17)
binary: rustc
commit-hash: 53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b
commit-date: 2021-06-17
host: x86_64-unknown-linux-gnu
release: 1.53.0
LLVM version: 12.0.1
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
[-]Clippy proposes an unstable attribute instead of a deprecated one for #[cfg_attr(rustfmt, rustfmt_skip)][/-][+]Clippy suggests an unstable attribute instead of a deprecated one for #[cfg_attr(rustfmt, rustfmt_skip)][/+]ibraheemdev commentedon Sep 2, 2021
The attribute is not unstable, attributes are just not supported on expressions. You can put
#[rustfmt::skip]
on the outer function. I don't think this is a bug.stephanemagnenat commentedon Sep 3, 2021
I see, but
#[cfg_attr(rustfmt, rustfmt_skip)]
does work on expressions. So in that sense, it is a regression (shrinking) of the feature-set, isn't it?fmease commentedon Jan 25, 2024
In the future, please report Clippy-specific issues over at https://github.com/rust-lang/rust-clippy.
fmease commentedon Jan 25, 2024
Could you provide a concrete reproducer? The
...
s from the issue description are way too vague.For example,
let _ = #[cfg_attr(…)] 0;
isn't a reproducer since it leads to an error and#[cfg_attr(...)] 0;
(on a statement expression) isn't one either because it compiles withcfg_attr
and withrustfmt::skip
.stephanemagnenat commentedon Jan 25, 2024
Sorry for reporting to the wrong place.
This issue can be reproduced by commenting the line 44 of this file (after cloning the repository and before running clippy on it).