Open
Description
Summary
The following line causes the collection_is_never_read
lint to highlight serde::Deserialize
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
Lint Name
collection_is_never_read
Reproducer
I tried this code:
pub enum Payload {
/// An initialization packet should be the first one sent to a node.
/// It is used to configure the node's parameters.
Initialization {
/// The type of the node being initialized.
#[cfg_attr(feature = "serde", serde(flatten))]
node_sort: NodeSort
},
/// The poll request packet is sent to a node to cause a receive data packet to be sent.
PollRequest,
/// A receive data packet is sent by a node (in response to a poll request packet)
/// and is used to send the node's input states to the controller.
ReceiveData {
/// The data which was read from the inputs.
data: Data
},
/// A transmit data packet is sent to a node to cause it's output states to be changed.
TransmitData {
/// The data to be written to the outputs.
data: Data
},
#[cfg(feature = "experimenter")]
#[cfg_attr(any(docrs, toolchain = "nightly"), doc(cfg(feature = "experimenter")))]
#[cfg_attr(not(toolchain = "nightly"), doc = "**Available on crate feature experimenter only.**\n\n")]
/// An unknown message type.
Unknown {
/// The packet's message type.
message_type: u8,
/// The packet's body.
body: Data
}
}
I saw this happen:
warning: collection is never read
--> cmri/src/packet/payload.rs:7:56
|
7 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
| ^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collection_is_never_read
= note: this warning originates in the derive macro `serde::Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
I expected to see this happen:
No output since removing serde::Deserialize
causes tests to start failing since it is needed.
Version
rustc 1.78.0-nightly (98aa3624b 2024-02-08)
binary: rustc
commit-hash: 98aa3624be70462d6a25ed5544333e3df62f4c66
commit-date: 2024-02-08
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 17.0.6
Additional Labels
No response