misc: Remove redundant "use" imports

With the nightly toolchain (2024-02-18) cargo check will flag up
redundant imports either because they are pulled in by the prelude on
earlier match.

Remove those redundant imports.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
Rob Bradford 2024-02-19 16:37:15 +00:00
parent 09f3658999
commit adb318f4cd
42 changed files with 19 additions and 67 deletions

View File

@ -300,8 +300,7 @@ mod tests {
use super::*;
use crate::layout::MPTABLE_START;
use vm_memory::{
bitmap::BitmapSlice, GuestAddress, GuestUsize, VolatileMemoryError, VolatileSlice,
WriteVolatile,
bitmap::BitmapSlice, GuestUsize, VolatileMemoryError, VolatileSlice, WriteVolatile,
};
fn table_entry_size(type_: u8) -> usize {

View File

@ -175,7 +175,6 @@ pub fn configure_segments_and_sregs(
#[cfg(test)]
mod tests {
use super::*;
use crate::GuestMemoryMmap;
use vm_memory::GuestAddress;
fn create_guest_mem() -> GuestMemoryMmap {

View File

@ -41,7 +41,6 @@ use smallvec::SmallVec;
use std::alloc::{alloc_zeroed, dealloc, Layout};
use std::cmp;
use std::collections::VecDeque;
use std::convert::TryInto;
use std::fmt::Debug;
use std::fs::File;
use std::io::{self, IoSlice, IoSliceMut, Read, Seek, SeekFrom, Write};

View File

@ -1822,7 +1822,6 @@ pub fn detect_image_type(file: &mut RawFile) -> Result<ImageType> {
#[cfg(test)]
mod tests {
use super::*;
use std::io::{Read, Seek, SeekFrom, Write};
use vmm_sys_util::tempfile::TempFile;
use vmm_sys_util::write_zeroes::WriteZeroes;

View File

@ -11,7 +11,6 @@
use crate::BlockBackend;
use libc::c_void;
use std::alloc::{alloc_zeroed, dealloc, Layout};
use std::convert::TryInto;
use std::fs::{File, Metadata};
use std::io::{self, Read, Seek, SeekFrom, Write};
use std::os::unix::io::{AsRawFd, RawFd};

View File

@ -3,7 +3,6 @@
// SPDX-License-Identifier: Apache-2.0
use crate::{read_aligned_block_size, DiskTopology};
use std::convert::TryInto;
use std::fs::File;
use std::io::{Seek, SeekFrom};

View File

@ -7,7 +7,6 @@ extern crate log;
use byteorder::{ByteOrder, LittleEndian, ReadBytesExt};
use remain::sorted;
use std::collections::btree_map::BTreeMap;
use std::convert::TryInto;
use std::fs::File;
use std::io::{self, Read, Seek, SeekFrom, Write};
use std::mem::size_of;

View File

@ -345,8 +345,7 @@ impl Migratable for Serial {}
#[cfg(test)]
mod tests {
use super::*;
use std::io;
use std::sync::{Arc, Mutex};
use std::sync::Mutex;
use vm_device::interrupt::{InterruptIndex, InterruptSourceConfig};
use vmm_sys_util::eventfd::EventFd;

View File

@ -10,10 +10,8 @@
// CMP-Compare Two Operands
//
use crate::arch::emulator::{EmulationError, PlatformEmulator};
use crate::arch::x86::emulator::instructions::*;
use crate::arch::x86::regs::*;
use crate::arch::x86::Exception;
// CMP affects OF, SF, ZF, AF, PF and CF
const FLAGS_MASK: u64 = CF | PF | AF | ZF | SF | OF;

View File

@ -12,9 +12,7 @@
// Copies the second operand (source operand) to the first operand (destination operand).
//
use crate::arch::emulator::{EmulationError, PlatformEmulator};
use crate::arch::x86::emulator::instructions::*;
use crate::arch::x86::Exception;
macro_rules! mov_rm_r {
($bound:ty) => {

View File

@ -10,10 +10,8 @@
// MOVS - Move Data from String to String
//
use crate::arch::emulator::{EmulationError, PlatformEmulator};
use crate::arch::x86::emulator::instructions::*;
use crate::arch::x86::regs::DF;
use crate::arch::x86::Exception;
macro_rules! movs {
($bound:ty) => {

View File

@ -10,9 +10,7 @@
// OR - Logical inclusive OR
//
use crate::arch::emulator::{EmulationError, PlatformEmulator};
use crate::arch::x86::emulator::instructions::*;
use crate::arch::x86::Exception;
macro_rules! or_rm_r {
($bound:ty) => {

View File

@ -651,10 +651,8 @@ mod mock_vmm {
#![allow(unused_mut)]
use super::*;
use crate::arch::emulator::{EmulationError, PlatformEmulator};
use crate::arch::x86::emulator::{Emulator, EmulatorCpuState as CpuState};
use crate::arch::x86::emulator::EmulatorCpuState as CpuState;
use crate::arch::x86::gdt::{gdt_entry, segment_from_gdt};
use crate::arch::x86::Exception;
use std::sync::{Arc, Mutex};
#[derive(Debug, Clone)]

View File

@ -7,7 +7,6 @@
use std::fmt;
use std::io;
use std::result::Result;
use std::str::FromStr;
use serde::de::{Deserialize, Deserializer, Error};

View File

@ -7,7 +7,7 @@ use crate::PciBarConfiguration;
use std::any::Any;
use std::fmt::{self, Display};
use std::sync::{Arc, Barrier, Mutex};
use std::{self, io, result};
use std::{io, result};
use vm_allocator::{AddressAllocator, SystemAllocator};
use vm_device::{BusDevice, Resource};

View File

@ -8,7 +8,6 @@
use crate::{mean, PerformanceTestControl};
use std::fs;
use std::path::PathBuf;
use std::string::String;
use std::thread;
use std::time::Duration;
use test_infra::Error as InfraError;

View File

@ -522,7 +522,6 @@ pub(crate) mod tests {
use super::*;
use std::fmt;
use std::thread;
use std::time::Duration;
impl TokenBucket {
// Resets the token bucket: budget set to max capacity and last-updated set to now.

View File

@ -762,7 +762,6 @@ fn start_vmm(cmd_arguments: ArgMatches) -> Result<Option<String>, Error> {
fn main() {
#[cfg(all(feature = "tdx", feature = "sev_snp"))]
compile_error!("Feature 'tdx' and 'sev_snp' are mutually exclusive.");
#[cfg(all(feature = "sev_snp", not(target_arch = "x86_64")))]
compile_error!("Feature 'sev_snp' needs target 'x86_64'");

View File

@ -9,7 +9,6 @@ use crate::{TPM_CRB_BUFFER_MAX, TPM_SUCCESS};
use anyhow::anyhow;
use libc::c_void;
use libc::{sockaddr_storage, socklen_t};
use std::convert::TryInto;
use std::os::unix::io::RawFd;
use std::path::Path;
use std::{mem, ptr};

View File

@ -10,7 +10,6 @@ pub mod emulator;
pub mod socket;
use anyhow::anyhow;
use std::convert::TryInto;
use thiserror::Error;
pub const TPM_CRB_BUFFER_MAX: usize = 3968; // 0x1_000 - 0x80

View File

@ -29,7 +29,6 @@ use std::result;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex, RwLock, RwLockWriteGuard};
use std::time::Instant;
use std::vec::Vec;
use std::{convert, error, fmt, io};
use vhost::vhost_user::message::*;
use vhost::vhost_user::Listener;

View File

@ -6,7 +6,7 @@
//
// SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause)
use libc::{self, EFD_NONBLOCK};
use libc::EFD_NONBLOCK;
use log::*;
use net_util::{
open_tap, MacAddr, NetCounters, NetQueuePair, OpenTapError, RxVirtio, Tap, TxVirtio,
@ -20,7 +20,6 @@ use std::ops::Deref;
use std::os::unix::io::{AsRawFd, RawFd};
use std::process;
use std::sync::{Arc, Mutex, RwLock};
use std::vec::Vec;
use vhost::vhost_user::message::*;
use vhost::vhost_user::Listener;
use vhost_user_backend::{VhostUserBackendMut, VhostUserDaemon, VringRwLock, VringT};

View File

@ -26,6 +26,7 @@ use rate_limiter::group::{RateLimiterGroup, RateLimiterGroupHandle};
use rate_limiter::TokenType;
use seccompiler::SeccompAction;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::io;
use std::num::Wrapping;
@ -35,7 +36,6 @@ use std::path::PathBuf;
use std::result;
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use std::sync::{Arc, Barrier};
use std::{collections::HashMap, convert::TryInto};
use thiserror::Error;
use versionize::{VersionMap, Versionize, VersionizeResult};
use versionize_derive::Versionize;

View File

@ -16,7 +16,6 @@ extern crate event_monitor;
extern crate log;
use serde::{Deserialize, Serialize};
use std::convert::TryInto;
use std::io;
use thiserror::Error;

View File

@ -24,6 +24,7 @@ use net_util::{
NetQueuePair, OpenTapError, RxVirtio, Tap, TapError, TxVirtio, VirtioNetConfig,
};
use seccompiler::SeccompAction;
use std::collections::HashMap;
use std::net::Ipv4Addr;
use std::num::Wrapping;
use std::ops::Deref;
@ -32,8 +33,6 @@ use std::result;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Barrier};
use std::thread;
use std::vec::Vec;
use std::{collections::HashMap, convert::TryInto};
use thiserror::Error;
use versionize::{VersionMap, Versionize, VersionizeResult};
use versionize_derive::Versionize;

View File

@ -8,7 +8,6 @@ use seccompiler::{
BpfProgram, Error, SeccompAction, SeccompCmpArgLen as ArgLen, SeccompCmpOp::Eq,
SeccompCondition as Cond, SeccompFilter, SeccompRule,
};
use std::convert::TryInto;
pub enum Thread {
VirtioBalloon,

View File

@ -330,8 +330,6 @@ mod tests {
use super::*;
use crate::GuestMemoryMmap;
use crate::{ActivateResult, VirtioInterrupt};
use std::sync::Arc;
use virtio_queue::Queue;
use vm_memory::GuestMemoryAtomic;
use vmm_sys_util::eventfd::EventFd;

View File

@ -16,7 +16,6 @@ use std::result;
use std::sync::atomic::AtomicBool;
use std::sync::{Arc, Barrier, Mutex};
use std::thread;
use std::vec::Vec;
use versionize::{VersionMap, Versionize, VersionizeResult};
use versionize_derive::Versionize;
use vhost::vhost_user::message::{

View File

@ -11,7 +11,7 @@ use crate::{
VirtioInterrupt, VirtioSharedMemoryList, VIRTIO_F_IOMMU_PLATFORM,
};
use crate::{GuestMemoryMmap, GuestRegionMmap, MmapRegion};
use libc::{self, c_void, off64_t, pread64, pwrite64};
use libc::{c_void, off64_t, pread64, pwrite64};
use seccompiler::SeccompAction;
use std::io;
use std::os::unix::io::AsRawFd;

View File

@ -16,7 +16,6 @@ use std::result;
use std::sync::atomic::AtomicBool;
use std::sync::{Arc, Barrier, Mutex};
use std::thread;
use std::vec::Vec;
use versionize::{VersionMap, Versionize, VersionizeResult};
use versionize_derive::Versionize;
use vhost::vhost_user::message::{VhostUserProtocolFeatures, VhostUserVirtioFeatures};

View File

@ -15,7 +15,6 @@ use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::thread::sleep;
use std::time::{Duration, Instant};
use std::vec::Vec;
use vhost::vhost_kern::vhost_binding::{VHOST_F_LOG_ALL, VHOST_VRING_F_LOG};
use vhost::vhost_user::message::{
VhostUserHeaderFlag, VhostUserInflight, VhostUserProtocolFeatures, VhostUserVirtioFeatures,

View File

@ -672,18 +672,13 @@ where
#[cfg(test)]
mod tests {
use libc::EFD_NONBLOCK;
use virtio_queue::QueueOwnedT;
use std::io::{Error as IoError, ErrorKind, Read, Result as IoResult, Write};
use std::os::unix::io::RawFd;
use std::time::{Duration, Instant};
use vmm_sys_util::eventfd::EventFd;
use super::super::super::defs::uapi;
use super::super::super::tests::TestContext;
use super::super::defs as csm_defs;
use super::*;
use libc::EFD_NONBLOCK;
use std::io::{Error as IoError, Result as IoResult};
use virtio_queue::QueueOwnedT;
use vmm_sys_util::eventfd::EventFd;
const LOCAL_CID: u64 = 2;
const PEER_CID: u64 = 3;

View File

@ -146,8 +146,8 @@ impl TxBuf {
mod tests {
use super::*;
use std::io::Error as IoError;
use std::io::ErrorKind;
use std::io::Result as IoResult;
use std::io::{ErrorKind, Write};
struct TestSink {
data: Vec<u8>,

View File

@ -530,7 +530,6 @@ mod tests {
use super::super::tests::{NoopVirtioInterrupt, TestContext};
use super::super::*;
use super::*;
use crate::vsock::device::{BACKEND_EVENT, EVT_QUEUE_EVENT, RX_QUEUE_EVENT, TX_QUEUE_EVENT};
use crate::ActivateError;
use libc::EFD_NONBLOCK;

View File

@ -851,16 +851,12 @@ impl VsockMuxer {
#[cfg(test)]
mod tests {
use std::io::{Read, Write};
use std::ops::Drop;
use std::os::unix::net::{UnixListener, UnixStream};
use std::path::{Path, PathBuf};
use virtio_queue::QueueOwnedT;
use super::super::super::csm::defs as csm_defs;
use super::super::super::tests::TestContext as VsockTestContext;
use super::*;
use std::io::Write;
use std::path::{Path, PathBuf};
use virtio_queue::QueueOwnedT;
const PEER_CID: u32 = 3;
const PEER_BUF_ALLOC: u32 = 64 * 1024;

View File

@ -7,7 +7,7 @@
//! Handles routing to devices in an address space.
use std::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
use std::cmp::Ordering;
use std::collections::btree_map::BTreeMap;
use std::sync::{Arc, Barrier, Mutex, RwLock, Weak};
use std::{convert, error, fmt, io, result};

View File

@ -10,7 +10,6 @@ use option_parser::{
};
use serde::{Deserialize, Serialize};
use std::collections::{BTreeSet, HashMap};
use std::convert::From;
use std::fmt;
use std::path::PathBuf;
use std::result;

View File

@ -2035,7 +2035,7 @@ mod unit_tests {
use crate::config::DebugConsoleConfig;
use config::{
ConsoleConfig, ConsoleOutputMode, CpusConfig, HotplugMethod, MemoryConfig, PayloadConfig,
RngConfig, VmConfig,
RngConfig,
};
fn create_dummy_vmm() -> Vmm {

View File

@ -28,7 +28,6 @@ use serde::{Deserialize, Serialize};
#[cfg(all(target_arch = "x86_64", feature = "guest_debug"))]
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::convert::TryInto;
use std::fs::{File, OpenOptions};
use std::io::{self};
use std::ops::{BitAnd, Deref, Not, Sub};

View File

@ -10,7 +10,7 @@
//
use crate::device_manager::{AddressManager, DeviceManagerError, DeviceManagerResult};
use acpi_tables::{self, aml, Aml};
use acpi_tables::{aml, Aml};
use arch::layout;
use pci::{DeviceRelocation, PciBdf, PciBus, PciConfigMmio, PciRoot};
#[cfg(target_arch = "x86_64")]

View File

@ -9,7 +9,6 @@ use seccompiler::{
BackendError, BpfProgram, Error, SeccompAction, SeccompCmpArgLen as ArgLen, SeccompCmpOp::Eq,
SeccompCondition as Cond, SeccompFilter, SeccompRule,
};
use std::convert::TryInto;
pub enum Thread {
HttpApi,

View File

@ -73,7 +73,6 @@ use serde::{Deserialize, Serialize};
use std::cmp;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::convert::TryInto;
use std::fs::{File, OpenOptions};
use std::io::{self, Seek, SeekFrom, Write};
#[cfg(all(target_arch = "x86_64", feature = "guest_debug"))]