You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run cargo fix --lib on the above, and it will remove the extern crate, leaving the attribute floating in limbo. Then, cargo check --lib --profile=test will demonstrate that the code is now broken.
The unused_extern_crates lint tries to avoid firing if there are attributes (see check_unused) but I'm guessing the cfg_attr strips the attribute (or doesn't add it in the first place), so the lint doesn't know there are any attributes.
A similar issue, the unused_extern_crates suggests use when it doesn't work. Given the following:
#![warn(unused_extern_crates)]#[cfg_attr(test, macro_use)]externcrate serde_derive as sd;#[derive(sd::Serialize)]pubstructZ;#[cfg(test)]mod m {#[derive(Deserialize)]structS;}
cargo fix --edition-idioms --lib will convert the extern crate to a use statement, keeping the macro_use attribute which won't work. cargo check --profile=test --lib will the fail to compile.
The text was updated successfully, but these errors were encountered:
If an
extern crate
has acfg_attr
that is not enabled, then it incorrectly suggests removing theextern crate
.Run
cargo fix --lib
on the above, and it will remove theextern crate
, leaving the attribute floating in limbo. Then,cargo check --lib --profile=test
will demonstrate that the code is now broken.The
unused_extern_crates
lint tries to avoid firing if there are attributes (see check_unused) but I'm guessing thecfg_attr
strips the attribute (or doesn't add it in the first place), so the lint doesn't know there are any attributes.A similar issue, the
unused_extern_crates
suggestsuse
when it doesn't work. Given the following:cargo fix --edition-idioms --lib
will convert theextern crate
to ause
statement, keeping themacro_use
attribute which won't work.cargo check --profile=test --lib
will the fail to compile.The text was updated successfully, but these errors were encountered: