misc: Remove unnecessary "extern crate"

Now all crates use edition = "2018" then the majority of the "extern
crate" statements can be removed. Only those for importing macros need
to remain.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2021-05-11 14:48:02 +00:00 committed by Sebastien Boeuf
parent 1205bce0ef
commit 496ceed1d0
35 changed files with 2 additions and 140 deletions

View File

@ -8,25 +8,11 @@
//! Supported platforms: x86_64, aarch64.
#![allow(clippy::transmute_ptr_to_ptr, clippy::redundant_static_lifetimes)]
extern crate anyhow;
extern crate byteorder;
extern crate hypervisor;
extern crate libc;
#[macro_use]
extern crate log;
#[cfg(feature = "acpi")]
extern crate acpi_tables;
extern crate linux_loader;
extern crate serde;
#[cfg(target_arch = "aarch64")]
extern crate vm_fdt;
extern crate vm_memory;
extern crate vm_migration;
#[cfg(target_arch = "aarch64")]
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate thiserror;
use std::fmt;
use std::result;

View File

@ -162,8 +162,6 @@ pub fn configure_segments_and_sregs(
#[cfg(test)]
mod tests {
extern crate vm_memory;
use super::*;
use vm_memory::{GuestAddress, GuestMemoryMmap};

View File

@ -52,7 +52,6 @@ impl BusDevice for AcpiShutdownDevice {
const SLEEP_VALUE_BIT: u8 = 2;
if data[0] == (S5_SLEEP_VALUE << SLEEP_VALUE_BIT) | (1 << SLEEP_STATUS_EN_BIT) {
debug!("ACPI Shutdown signalled");
extern crate bitflags;
if let Err(e) = self.exit_evt.write(1) {
error!("Error triggering ACPI shutdown event: {}", e);
}

View File

@ -6,20 +6,11 @@
// found in the LICENSE-BSD-3-Clause file.
//! Emulates virtual and hardware devices.
extern crate anyhow;
#[macro_use]
extern crate bitflags;
extern crate byteorder;
extern crate epoll;
extern crate libc;
#[macro_use]
extern crate log;
#[cfg(feature = "acpi")]
extern crate acpi_tables;
extern crate vm_device;
extern crate vm_memory;
extern crate vm_migration;
extern crate vmm_sys_util;
#[cfg(feature = "acpi")]
pub mod acpi;

View File

@ -4,8 +4,6 @@
// SPDX-License-Identifier: Apache-2.0
//
extern crate thiserror;
use core::fmt::Debug;
use std::fmt::{self, Display};
use thiserror::Error;

View File

@ -10,8 +10,6 @@
// CMP-Compare Two Operands
//
extern crate iced_x86;
use crate::arch::emulator::{EmulationError, PlatformEmulator};
use crate::arch::x86::emulator::instructions::*;
use crate::arch::x86::regs::*;

View File

@ -4,8 +4,6 @@
// SPDX-License-Identifier: Apache-2.0
//
extern crate iced_x86;
use crate::arch::emulator::{EmulationError, PlatformEmulator, PlatformError};
use crate::arch::x86::emulator::CpuStateManager;
use crate::arch::x86::Exception;

View File

@ -12,8 +12,6 @@
// Copies the second operand (source operand) to the first operand (destination operand).
//
extern crate iced_x86;
use crate::arch::emulator::{EmulationError, PlatformEmulator};
use crate::arch::x86::emulator::instructions::*;
use crate::arch::x86::Exception;

View File

@ -10,8 +10,6 @@
// MOVS - Move Data from String to String
//
extern crate iced_x86;
use crate::arch::emulator::{EmulationError, PlatformEmulator};
use crate::arch::x86::emulator::instructions::*;
use crate::arch::x86::regs::DF;

View File

@ -4,8 +4,6 @@
// SPDX-License-Identifier: Apache-2.0
//
extern crate iced_x86;
use crate::arch::emulator::{EmulationError, EmulationResult, PlatformEmulator, PlatformError};
use crate::arch::x86::emulator::instructions::*;
use crate::arch::x86::regs::*;
@ -640,8 +638,6 @@ impl<'a, T: CpuStateManager> Emulator<'a, T> {
mod mock_vmm {
#![allow(unused_mut)]
extern crate env_logger;
use super::*;
use crate::arch::emulator::{EmulationError, PlatformEmulator};
use crate::arch::x86::emulator::{Emulator, EmulatorCpuState as CpuState};

View File

@ -23,10 +23,6 @@ extern crate anyhow;
#[cfg(target_arch = "x86_64")]
#[macro_use]
extern crate log;
extern crate serde;
extern crate serde_derive;
extern crate serde_json;
extern crate thiserror;
/// Architecture specific definitions
#[macro_use]

View File

@ -10,16 +10,8 @@
#[cfg(test)]
#[macro_use]
extern crate lazy_static;
extern crate libc;
#[macro_use]
extern crate log;
extern crate net_gen;
extern crate rate_limiter;
extern crate serde;
extern crate virtio_bindings;
extern crate vm_memory;
extern crate vm_virtio;
extern crate vmm_sys_util;
mod mac;
mod open_tap;

View File

@ -152,8 +152,6 @@ impl FromStr for MacAddr {
#[cfg(test)]
mod tests {
extern crate serde_json;
use super::*;
#[test]

View File

@ -5,12 +5,8 @@
//! Implements pci devices and busses.
#[macro_use]
extern crate log;
extern crate hypervisor;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate vm_memory;
mod bus;
mod configuration;

View File

@ -3,9 +3,6 @@
// SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
//
extern crate byteorder;
extern crate vm_memory;
use byteorder::{ByteOrder, LittleEndian};
use std::sync::Arc;
use vm_device::interrupt::{

View File

@ -3,9 +3,6 @@
// SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
//
extern crate byteorder;
extern crate vm_memory;
use crate::{PciCapability, PciCapabilityId};
use anyhow::anyhow;
use byteorder::{ByteOrder, LittleEndian};

View File

@ -3,8 +3,6 @@
// SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
//
extern crate vm_allocator;
use crate::{
msi_num_enabled_vectors, BarReprogrammingParams, MsiConfig, MsixCap, MsixConfig,
PciBarConfiguration, PciBarRegionType, PciCapabilityId, PciClassCode, PciConfiguration,

View File

@ -5,9 +5,6 @@
#[macro_use(crate_authors)]
extern crate clap;
extern crate api_client;
extern crate serde_json;
extern crate vmm;
use api_client::simple_api_command;
use api_client::Error as ApiClientError;

View File

@ -3,14 +3,8 @@
// SPDX-License-Identifier: Apache-2.0
//
extern crate anyhow;
extern crate signal_hook;
extern crate vmm;
extern crate vmm_sys_util;
#[macro_use(crate_authors)]
extern crate clap;
#[macro_use]
extern crate event_monitor;

View File

@ -8,11 +8,6 @@
//
// SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause)
extern crate block_util;
extern crate log;
extern crate vhost;
extern crate vhost_user_backend;
use block_util::{build_disk_image_id, Request, VirtioBlockConfig};
use libc::EFD_NONBLOCK;
use log::*;

View File

@ -6,11 +6,6 @@
//
// SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause)
extern crate log;
extern crate net_util;
extern crate vhost;
extern crate vhost_user_backend;
use libc::{self, EFD_NONBLOCK};
use log::*;
use net_util::{

View File

@ -8,7 +8,6 @@
#[macro_use(crate_version, crate_authors)]
extern crate clap;
extern crate vhost_user_net;
use clap::{App, Arg};
use vhost_user_net::start_net_backend;

View File

@ -17,7 +17,6 @@ use super::{
VirtioCommon, VirtioDevice, VirtioDeviceType, EPOLL_HELPER_EVENT_LAST, VIRTIO_F_VERSION_1,
};
use crate::seccomp_filters::{get_seccomp_filter, Thread};
use crate::vm_memory::GuestMemory;
use crate::{VirtioInterrupt, VirtioInterruptType};
use libc::EFD_NONBLOCK;
use seccomp::{SeccompAction, SeccompFilter};
@ -29,6 +28,7 @@ use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use std::sync::mpsc;
use std::sync::{Arc, Barrier, Mutex};
use std::thread;
use vm_memory::GuestMemory;
use vm_memory::{
Address, ByteValued, Bytes, GuestAddress, GuestAddressSpace, GuestMemoryAtomic,
GuestMemoryError, GuestMemoryMmap,

View File

@ -10,21 +10,12 @@
//! Implements virtio devices, queues, and transport mechanisms.
extern crate arc_swap;
extern crate epoll;
#[macro_use]
extern crate event_monitor;
#[macro_use]
extern crate log;
extern crate pci;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate vhost;
extern crate virtio_bindings;
extern crate vm_device;
extern crate vm_memory;
use std::convert::TryInto;
use std::io;

View File

@ -5,7 +5,6 @@
// Copyright © 2019 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
extern crate byteorder;
use crate::{Queue, VirtioDevice};
use byteorder::{ByteOrder, LittleEndian};

View File

@ -6,11 +6,6 @@
//
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
extern crate pci;
extern crate vm_allocator;
extern crate vm_memory;
extern crate vmm_sys_util;
use super::VirtioPciCommonConfig;
use crate::transport::VirtioTransport;
use crate::{

View File

@ -1,12 +1,6 @@
// Copyright 2019 Intel Corporation. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
extern crate epoll;
extern crate net_util;
extern crate vhost;
extern crate virtio_bindings;
extern crate vm_memory;
use std::io;
use vhost::Error as VhostError;
use vm_memory::Error as MmapError;

View File

@ -10,9 +10,6 @@
//! Manages system resources that can be allocated to VMs and their devices.
extern crate libc;
extern crate vm_memory;
mod address;
mod gsi;
mod system;

View File

@ -5,7 +5,6 @@
#[macro_use]
extern crate serde_derive;
extern crate vm_memory;
mod bus;
pub mod dma_mapping;

View File

@ -3,11 +3,8 @@
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
//
extern crate serde;
extern crate thiserror;
#[macro_use]
extern crate serde_derive;
extern crate vm_memory;
use anyhow::anyhow;
use serde::{Deserialize, Serialize};

View File

@ -966,8 +966,6 @@ pub mod testing {
#[cfg(test)]
pub mod tests {
extern crate vm_memory;
use super::testing::*;
pub use super::*;
use vm_memory::{GuestAddress, GuestMemoryMmap};

View File

@ -28,9 +28,6 @@
//! response channel Receiver.
//! 5. The thread handles the response and forwards potential errors.
extern crate vm_device;
extern crate vmm_sys_util;
pub use self::http::start_http_fd_thread;
pub use self::http::start_http_path_thread;

View File

@ -3,21 +3,14 @@
// SPDX-License-Identifier: Apache-2.0
//
extern crate anyhow;
extern crate arc_swap;
#[macro_use]
extern crate event_monitor;
extern crate hypervisor;
extern crate option_parser;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate vmm_sys_util;
#[cfg(test)]
#[macro_use]
extern crate credibility;

View File

@ -2,7 +2,6 @@
//
// SPDX-License-Identifier: Apache-2.0
//
extern crate hypervisor;
#[cfg(target_arch = "x86_64")]
use crate::config::SgxEpcConfig;
use crate::config::{HotplugMethod, MemoryConfig, MemoryZoneConfig};

View File

@ -11,17 +11,6 @@
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
//
extern crate arch;
extern crate devices;
extern crate epoll;
extern crate hypervisor;
extern crate libc;
extern crate linux_loader;
extern crate net_util;
extern crate signal_hook;
extern crate vm_allocator;
extern crate vm_memory;
#[cfg(feature = "acpi")]
use crate::config::NumaConfig;
use crate::config::{