Skip to content

Commit 714e762

Browse files
RuoqingHemtjhrc
authored andcommitted
rustc: Allow Descriptor and VirtioRng to be unused
Rust v1.89.0 is complaining about VirtioRng, VirtioSnd and Descriptor being unused, remove VirtioRng, VirtioSnd and add #[allow(unused)] to suppress those warnings. ```console warning: struct `Descriptor` is never constructed --> src/rutabaga_gfx/src/rutabaga_os/descriptor.rs:143:12 | 143 | pub struct Descriptor(pub RawDescriptor); | ^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default ``` Signed-off-by: Ruoqing He <[email protected]>
1 parent bf7e313 commit 714e762

File tree

3 files changed

+1
-8
lines changed

3 files changed

+1
-8
lines changed

src/devices/src/virtio/rng/device.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ pub(crate) const REQ_INDEX: usize = 0;
1414
// Supported features.
1515
pub(crate) const AVAIL_FEATURES: u64 = 1 << uapi::VIRTIO_F_VERSION_1 as u64;
1616

17-
#[derive(Copy, Clone, Debug, Default)]
18-
#[repr(C, packed)]
19-
pub struct VirtioRng {}
20-
2117
pub struct Rng {
2218
pub(crate) queues: Vec<VirtQueue>,
2319
pub(crate) queue_events: Vec<EventFd>,

src/devices/src/virtio/snd/device.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ use crate::virtio::{DeviceState, InterruptTransport};
1515
// Supported features.
1616
pub(crate) const AVAIL_FEATURES: u64 = 1 << uapi::VIRTIO_F_VERSION_1 as u64;
1717

18-
#[derive(Copy, Clone, Debug, Default)]
19-
#[repr(C, packed)]
20-
pub struct VirtioSnd {}
21-
2218
pub struct Snd {
2319
pub(crate) queues: Vec<VirtQueue>,
2420
pub(crate) queue_events: Vec<EventFd>,

src/rutabaga_gfx/src/rutabaga_os/descriptor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ impl From<File> for SafeDescriptor {
138138
///
139139
/// Note that with the exception of the last use-case (which requires proper error checking against
140140
/// the descriptor being closed), the `Descriptor` instance would be very short-lived.
141+
#[allow(unused)]
141142
#[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
142143
#[repr(transparent)]
143144
pub struct Descriptor(pub RawDescriptor);

0 commit comments

Comments
 (0)