diff options
author | David Tolnay <dtolnay@chromium.org> | 2019-04-11 14:30:00 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-15 02:06:08 -0700 |
commit | aecf9a4dee6c004bceabf268a5b36d24c3744ca6 (patch) | |
tree | f43a4fae670c5e3366d30d405b8f603d44a6464f | |
parent | 633426a8fc20a5eef402e159d53228aae13bbaa5 (diff) | |
download | crosvm-aecf9a4dee6c004bceabf268a5b36d24c3744ca6.tar crosvm-aecf9a4dee6c004bceabf268a5b36d24c3744ca6.tar.gz crosvm-aecf9a4dee6c004bceabf268a5b36d24c3744ca6.tar.bz2 crosvm-aecf9a4dee6c004bceabf268a5b36d24c3744ca6.tar.lz crosvm-aecf9a4dee6c004bceabf268a5b36d24c3744ca6.tar.xz crosvm-aecf9a4dee6c004bceabf268a5b36d24c3744ca6.tar.zst crosvm-aecf9a4dee6c004bceabf268a5b36d24c3744ca6.zip |
edition: Remove extern crate lines
In Rust 2018 edition, `extern crate` is no longer required for importing from other crates. Instead of writing: extern crate dep; use dep::Thing; we write: use dep::Thing; In this approach, macros are imported individually from the declaring crate rather than through #[macro_use]. Before: #[macro_use] extern crate sys_util; After: use sys_util::{debug, error}; The only place that `extern crate` continues to be required is in importing the compiler's proc_macro API into a procedural macro crate. This will hopefully be fixed in a future Rust release. extern crate proc_macro; TEST=cargo check TEST=cargo check --all-features TEST=cargo check --target aarch64-unknown-linux-gnu TEST=local kokoro Change-Id: I0b43768c0d81f2a250b1959fb97ba35cbac56293 Reviewed-on: https://chromium-review.googlesource.com/1565302 Commit-Ready: David Tolnay <dtolnay@chromium.org> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: David Tolnay <dtolnay@chromium.org>
60 files changed, 9 insertions, 331 deletions
diff --git a/aarch64/src/lib.rs b/aarch64/src/lib.rs index 07fbff5..95e633f 100644 --- a/aarch64/src/lib.rs +++ b/aarch64/src/lib.rs @@ -2,19 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate arch; -extern crate data_model; -extern crate devices; -extern crate io_jail; -extern crate kernel_cmdline; -extern crate kvm; -extern crate kvm_sys; -extern crate libc; -extern crate remain; -extern crate resources; -extern crate sync; -extern crate sys_util; - use std::error::Error as StdError; use std::ffi::{CStr, CString}; use std::fmt::{self, Display}; diff --git a/arch/src/lib.rs b/arch/src/lib.rs index 1e55caf..01c16a0 100644 --- a/arch/src/lib.rs +++ b/arch/src/lib.rs @@ -4,16 +4,6 @@ pub mod fdt; -extern crate byteorder; -extern crate devices; -extern crate io_jail; -extern crate kernel_cmdline; -extern crate kvm; -extern crate libc; -extern crate resources; -extern crate sync; -extern crate sys_util; - use std::collections::BTreeMap; use std::error::Error as StdError; use std::fmt::{self, Display}; diff --git a/assertions/src/lib.rs b/assertions/src/lib.rs index 316e7d2..2e9d188 100644 --- a/assertions/src/lib.rs +++ b/assertions/src/lib.rs @@ -20,7 +20,6 @@ pub use crate::mechanism::*; /// # Example /// /// ```rust -/// extern crate assertions; /// use assertions::const_assert; /// /// fn main() { @@ -31,7 +30,6 @@ pub use crate::mechanism::*; /// # Example that fails to compile /// /// ```rust,compile_fail -/// extern crate assertions; /// use assertions::const_assert; /// /// fn main() { diff --git a/bit_field/bit_field_derive/bit_field_derive.rs b/bit_field/bit_field_derive/bit_field_derive.rs index e7d26cd..e81f481 100644 --- a/bit_field/bit_field_derive/bit_field_derive.rs +++ b/bit_field/bit_field_derive/bit_field_derive.rs @@ -3,14 +3,8 @@ // found in the LICENSE file. #![recursion_limit = "256"] -extern crate proc_macro; -extern crate proc_macro2; - -#[macro_use] -extern crate quote; -#[macro_use] -extern crate syn; +extern crate proc_macro; use proc_macro2::{Span, TokenStream}; use quote::{quote, quote_spanned}; diff --git a/bit_field/src/lib.rs b/bit_field/src/lib.rs index bd11c3c..1455430 100644 --- a/bit_field/src/lib.rs +++ b/bit_field/src/lib.rs @@ -28,8 +28,6 @@ //! first three fields. //! //! ``` -//! extern crate bit_field; -//! //! use bit_field::*; //! //! #[bitfield] @@ -88,8 +86,6 @@ //! `B1` but with accessors that use `bool` rather than `u8`. //! //! ``` -//! extern crate bit_field; -//! //! use bit_field::*; //! //! #[bitfield] @@ -105,8 +101,6 @@ //! the width with `#[bits = N]`. This should be used to improve type safety. //! //! ``` -//! extern crate bit_field; -//! //! use bit_field::*; //! //! #[bitfield] @@ -133,8 +127,6 @@ //! any variant will result in an `Err(u64)`. //! //! ``` -//! extern crate bit_field; -//! //! use bit_field::*; //! //! #[bitfield] @@ -159,8 +151,6 @@ //! getter and setter are defined in terms of the given enum type. //! //! ``` -//! extern crate bit_field; -//! //! use bit_field::*; //! //! #[bitfield] @@ -187,8 +177,6 @@ //! a bitfield struct. //! //! ``` -//! extern crate bit_field; -//! //! use bit_field::*; //! //! #[bitfield] @@ -215,8 +203,6 @@ //! rewriting by the macro. //! //! ``` -//! extern crate bit_field; -//! //! use bit_field::*; //! //! #[bitfield] @@ -235,8 +221,6 @@ //! > the trait `bit_field::checks::TotalSizeIsMultipleOfEightBits` is not implemented //! //! ```compile_fail -//! extern crate bit_field; -//! //! use bit_field::*; //! //! #[bitfield] @@ -251,8 +235,6 @@ //! (2^n)-1, it will be caught at compile time. //! //! ```compile_fail -//! extern crate bit_field; -//! //! use bit_field::*; //! //! #[bitfield] @@ -268,8 +250,6 @@ //! number of bits in that field, it will be caught. //! //! ```compile_fail -//! extern crate bit_field; -//! //! use bit_field::*; //! //! #[bitfield] @@ -289,10 +269,6 @@ use std::fmt::{self, Display}; -#[allow(unused_imports)] -#[macro_use] -extern crate bit_field_derive; - pub use bit_field_derive::bitfield; /// Error type for bit field get. diff --git a/bit_field/tests/test_enum.rs b/bit_field/tests/test_enum.rs index 8746b06..3ce6edb 100644 --- a/bit_field/tests/test_enum.rs +++ b/bit_field/tests/test_enum.rs @@ -1,5 +1,3 @@ -extern crate bit_field; - use bit_field::*; #[bitfield] diff --git a/bit_field/tests/test_tuple_struct.rs b/bit_field/tests/test_tuple_struct.rs index 3b12735..b92d99c 100644 --- a/bit_field/tests/test_tuple_struct.rs +++ b/bit_field/tests/test_tuple_struct.rs @@ -1,5 +1,3 @@ -extern crate bit_field; - use bit_field::*; #[bitfield] diff --git a/crosvm_plugin/src/lib.rs b/crosvm_plugin/src/lib.rs index 8b0a222..5c1f168 100644 --- a/crosvm_plugin/src/lib.rs +++ b/crosvm_plugin/src/lib.rs @@ -15,13 +15,6 @@ //! connection's socket. Then, that socket is read for a `MainResponse` or `VcpuResponse`, which is //! translated to the appropriate return type for the C API. -extern crate kvm; -extern crate kvm_sys; -extern crate libc; -extern crate protobuf; -extern crate protos; -extern crate sys_util; - use std::env; use std::fs::File; use std::mem::{size_of, swap}; diff --git a/data_model/src/lib.rs b/data_model/src/lib.rs index d3f3517..7d3fd46 100644 --- a/data_model/src/lib.rs +++ b/data_model/src/lib.rs @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate assertions; - use std::mem::size_of; use std::slice::{from_raw_parts, from_raw_parts_mut}; diff --git a/devices/src/lib.rs b/devices/src/lib.rs index d28ea15..3b2c0b2 100644 --- a/devices/src/lib.rs +++ b/devices/src/lib.rs @@ -4,31 +4,6 @@ //! Emulates virtual and hardware devices. -extern crate audio_streams; -extern crate bit_field; -extern crate byteorder; -extern crate data_model; -extern crate enumn; -extern crate io_jail; -extern crate kvm; -extern crate libc; -extern crate msg_on_socket_derive; -extern crate msg_socket; -extern crate net_sys; -extern crate net_util; -extern crate p9; -extern crate remain; -extern crate resources; -extern crate sync; -#[macro_use] -extern crate sys_util; -#[cfg(feature = "tpm")] -extern crate tpm2; -extern crate usb_util; -extern crate vhost; -extern crate virtio_sys; -extern crate vm_control; - mod bus; mod cmos; mod i8042; diff --git a/devices/src/usb/mod.rs b/devices/src/usb/mod.rs index 738c693..dde6189 100644 --- a/devices/src/usb/mod.rs +++ b/devices/src/usb/mod.rs @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate usb_util; - #[macro_use] mod log; pub mod host_backend; diff --git a/devices/src/virtio/gpu/mod.rs b/devices/src/virtio/gpu/mod.rs index a91b5b9..251b59c 100644 --- a/devices/src/virtio/gpu/mod.rs +++ b/devices/src/virtio/gpu/mod.rs @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate gpu_buffer; -extern crate gpu_display; -extern crate gpu_renderer; - mod backend; mod protocol; diff --git a/enumn/src/lib.rs b/enumn/src/lib.rs index 417ba96..416eadc 100644 --- a/enumn/src/lib.rs +++ b/enumn/src/lib.rs @@ -104,9 +104,6 @@ #![recursion_limit = "128"] extern crate proc_macro; -extern crate proc_macro2; -extern crate quote; -extern crate syn; #[cfg(test)] mod tests; diff --git a/fuzz/block_fuzzer.rs b/fuzz/block_fuzzer.rs index 5c3106a..f315a87 100644 --- a/fuzz/block_fuzzer.rs +++ b/fuzz/block_fuzzer.rs @@ -3,11 +3,6 @@ // found in the LICENSE file. #![no_main] -extern crate devices; -extern crate libc; -extern crate sys_util; - -use sys_util::{EventFd, GuestAddress, GuestMemory, SharedMemory}; use std::fs::File; use std::io::{Cursor, Read, Seek, SeekFrom}; @@ -20,6 +15,7 @@ use std::sync::atomic::AtomicUsize; use std::sync::Arc; use devices::virtio::{Block, Queue, VirtioDevice}; +use sys_util::{EventFd, GuestAddress, GuestMemory, SharedMemory}; const MEM_SIZE: u64 = 256 * 1024 * 1024; const DESC_SIZE: u64 = 16; // Bytes in one virtio descriptor. diff --git a/fuzz/qcow_fuzzer.rs b/fuzz/qcow_fuzzer.rs index 0f7ff2a..e6175ff 100644 --- a/fuzz/qcow_fuzzer.rs +++ b/fuzz/qcow_fuzzer.rs @@ -3,9 +3,6 @@ // found in the LICENSE file. #![no_main] -extern crate libc; -extern crate qcow; -extern crate sys_util; use qcow::QcowFile; use sys_util::SharedMemory; diff --git a/fuzz/zimage_fuzzer.rs b/fuzz/zimage_fuzzer.rs index 13b67b3..fdcb7db 100644 --- a/fuzz/zimage_fuzzer.rs +++ b/fuzz/zimage_fuzzer.rs @@ -3,9 +3,6 @@ // found in the LICENSE file. #![no_main] -extern crate kernel_loader; -extern crate libc; -extern crate sys_util; use sys_util::{GuestAddress, GuestMemory}; diff --git a/gpu_buffer/src/lib.rs b/gpu_buffer/src/lib.rs index b69afc7..f35f5fd 100644 --- a/gpu_buffer/src/lib.rs +++ b/gpu_buffer/src/lib.rs @@ -30,10 +30,6 @@ //! # } //! ``` -extern crate data_model; -#[macro_use] -extern crate sys_util; - mod drm_formats; mod raw; pub mod rendernode; diff --git a/gpu_display/build.rs b/gpu_display/build.rs index 33a8653..69c0fae 100644 --- a/gpu_display/build.rs +++ b/gpu_display/build.rs @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate cc; - use std::env; use std::ffi::OsStr; use std::fs; diff --git a/gpu_display/examples/simple.rs b/gpu_display/examples/simple.rs index e3499f8..fcf2e54 100644 --- a/gpu_display/examples/simple.rs +++ b/gpu_display/examples/simple.rs @@ -1,5 +1,3 @@ -extern crate gpu_display; - use gpu_display::*; fn main() { diff --git a/gpu_display/src/lib.rs b/gpu_display/src/lib.rs index c52e5e9..11a6703 100644 --- a/gpu_display/src/lib.rs +++ b/gpu_display/src/lib.rs @@ -4,9 +4,6 @@ //! Crate for displaying simple surfaces and GPU buffers over wayland. -extern crate data_model; -extern crate sys_util; - mod dwl; use std::cell::Cell; diff --git a/gpu_renderer/src/lib.rs b/gpu_renderer/src/lib.rs index 1852f0a..b4abfca 100644 --- a/gpu_renderer/src/lib.rs +++ b/gpu_renderer/src/lib.rs @@ -4,10 +4,6 @@ //! A crate for using hardware acceleration to render virtio-gpu's virgl command streams. -extern crate data_model; -extern crate libc; -extern crate sys_util; - mod command_buffer; mod generated; mod pipe_format_fourcc; diff --git a/io_jail/src/lib.rs b/io_jail/src/lib.rs index 26f96d7..43698aa 100644 --- a/io_jail/src/lib.rs +++ b/io_jail/src/lib.rs @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate libc; - #[allow(dead_code)] #[allow(non_camel_case_types)] #[allow(non_snake_case)] diff --git a/io_jail/src/libminijail.rs b/io_jail/src/libminijail.rs index 6edacdc..f8c3654 100644 --- a/io_jail/src/libminijail.rs +++ b/io_jail/src/libminijail.rs @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate libc; - use libc::{gid_t, pid_t, uid_t}; use std::os::raw::{c_char, c_int, c_ulong}; diff --git a/kernel_loader/src/lib.rs b/kernel_loader/src/lib.rs index 15693a6..66a8dfb 100644 --- a/kernel_loader/src/lib.rs +++ b/kernel_loader/src/lib.rs @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate sys_util; - use std::ffi::CStr; use std::fmt::{self, Display}; use std::io::{Read, Seek, SeekFrom}; diff --git a/kvm/src/lib.rs b/kvm/src/lib.rs index 67a2f23..919aad3 100644 --- a/kvm/src/lib.rs +++ b/kvm/src/lib.rs @@ -4,12 +4,6 @@ //! A safe wrapper around the kernel's KVM interface. -extern crate kvm_sys; -extern crate libc; -#[macro_use] -extern crate sys_util; -extern crate msg_socket; - mod cap; use std::cmp::{min, Ordering}; diff --git a/kvm/tests/dirty_log.rs b/kvm/tests/dirty_log.rs index 645a01d..4efb208 100644 --- a/kvm/tests/dirty_log.rs +++ b/kvm/tests/dirty_log.rs @@ -4,10 +4,6 @@ #![cfg(any(target_arch = "x86", target_arch = "x86_64"))] -extern crate kvm; -extern crate kvm_sys; -extern crate sys_util; - use kvm::*; use kvm_sys::kvm_regs; use sys_util::{GuestAddress, GuestMemory, MemoryMapping, SharedMemory}; diff --git a/kvm/tests/read_only_memory.rs b/kvm/tests/read_only_memory.rs index 5114ce4..c1dd854 100644 --- a/kvm/tests/read_only_memory.rs +++ b/kvm/tests/read_only_memory.rs @@ -4,10 +4,6 @@ #![cfg(any(target_arch = "x86", target_arch = "x86_64"))] -extern crate kvm; -extern crate kvm_sys; -extern crate sys_util; - use kvm::*; use kvm_sys::kvm_regs; use sys_util::{GuestAddress, GuestMemory, MemoryMapping, SharedMemory}; diff --git a/kvm/tests/real_run_adder.rs b/kvm/tests/real_run_adder.rs index 5a7b536..a419ad9 100644 --- a/kvm/tests/real_run_adder.rs +++ b/kvm/tests/real_run_adder.rs @@ -4,10 +4,6 @@ #![cfg(any(target_arch = "x86", target_arch = "x86_64"))] -extern crate kvm; -extern crate kvm_sys; -extern crate sys_util; - use kvm::*; use kvm_sys::kvm_regs; use sys_util::{GuestAddress, GuestMemory}; diff --git a/kvm_sys/src/lib.rs b/kvm_sys/src/lib.rs index bea9242..9000b79 100644 --- a/kvm_sys/src/lib.rs +++ b/kvm_sys/src/lib.rs @@ -6,9 +6,6 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] -#[macro_use] -extern crate sys_util; - use sys_util::{ioctl_io_nr, ioctl_ior_nr, ioctl_iow_nr, ioctl_iowr_nr}; // Somehow this one gets missed by bindgen diff --git a/kvm_sys/tests/sanity.rs b/kvm_sys/tests/sanity.rs index 2dd1326..7669b44 100644 --- a/kvm_sys/tests/sanity.rs +++ b/kvm_sys/tests/sanity.rs @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate kvm_sys; -extern crate libc; - use libc::{c_char, ioctl, open, O_RDWR}; use kvm_sys::*; diff --git a/msg_socket/msg_on_socket_derive/msg_on_socket_derive.rs b/msg_socket/msg_on_socket_derive/msg_on_socket_derive.rs index bb90255..5116d7e 100644 --- a/msg_socket/msg_on_socket_derive/msg_on_socket_derive.rs +++ b/msg_socket/msg_on_socket_derive/msg_on_socket_derive.rs @@ -4,13 +4,6 @@ #![recursion_limit = "256"] extern crate proc_macro; -extern crate proc_macro2; - -#[macro_use] -extern crate quote; - -#[macro_use] -extern crate syn; use std::vec::Vec; diff --git a/msg_socket/src/lib.rs b/msg_socket/src/lib.rs index c3cc411..bead3da 100644 --- a/msg_socket/src/lib.rs +++ b/msg_socket/src/lib.rs @@ -2,13 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#[allow(unused_imports)] -#[macro_use] -extern crate msg_on_socket_derive; -extern crate data_model; -#[macro_use] -extern crate sys_util; - mod msg_on_socket; use std::io::Result; diff --git a/msg_socket/tests/enum.rs b/msg_socket/tests/enum.rs index 9134f6e..b4c7189 100644 --- a/msg_socket/tests/enum.rs +++ b/msg_socket/tests/enum.rs @@ -1,7 +1,3 @@ -extern crate msg_on_socket_derive; -extern crate msg_socket; -extern crate sys_util; - use sys_util::EventFd; use msg_socket::*; diff --git a/msg_socket/tests/struct.rs b/msg_socket/tests/struct.rs index a2d5c9c..2cc9d37 100644 --- a/msg_socket/tests/struct.rs +++ b/msg_socket/tests/struct.rs @@ -1,7 +1,3 @@ -extern crate msg_on_socket_derive; -extern crate msg_socket; -extern crate sys_util; - use sys_util::EventFd; use msg_socket::*; diff --git a/msg_socket/tests/tuple.rs b/msg_socket/tests/tuple.rs index 717cd91..b388328 100644 --- a/msg_socket/tests/tuple.rs +++ b/msg_socket/tests/tuple.rs @@ -1,10 +1,5 @@ -extern crate msg_on_socket_derive; -extern crate msg_socket; -extern crate sys_util; - -use sys_util::EventFd; - use msg_socket::*; +use sys_util::EventFd; #[derive(MsgOnSocket)] struct Message(u8, u16, EventFd); diff --git a/net_sys/src/lib.rs b/net_sys/src/lib.rs index 4be0a16..9df49e4 100644 --- a/net_sys/src/lib.rs +++ b/net_sys/src/lib.rs @@ -6,9 +6,6 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] -#[macro_use] -extern crate sys_util; - use sys_util::{ioctl_ior_nr, ioctl_iow_nr}; // generated with bindgen /usr/include/linux/if.h --no-unstable-rust diff --git a/net_util/src/lib.rs b/net_util/src/lib.rs index 456608c..0a903fc 100644 --- a/net_util/src/lib.rs +++ b/net_util/src/lib.rs @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate libc; -extern crate net_sys; -extern crate sys_util; - use std::fmt::{self, Display}; use std::fs::File; use std::io::{Read, Result as IoResult, Write}; diff --git a/p9/src/lib.rs b/p9/src/lib.rs index 9bd8c05..56195f1 100644 --- a/p9/src/lib.rs +++ b/p9/src/lib.rs @@ -2,11 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate libc; - -#[macro_use] -extern crate wire_format_derive; - mod protocol; mod server; diff --git a/p9/wire_format_derive/wire_format_derive.rs b/p9/wire_format_derive/wire_format_derive.rs index 38af595..ea19b89 100644 --- a/p9/wire_format_derive/wire_format_derive.rs +++ b/p9/wire_format_derive/wire_format_derive.rs @@ -9,13 +9,6 @@ #![recursion_limit = "256"] extern crate proc_macro; -extern crate proc_macro2; - -#[macro_use] -extern crate quote; - -#[macro_use] -extern crate syn; use proc_macro2::{Span, TokenStream}; use quote::{quote, quote_spanned}; @@ -46,9 +39,8 @@ fn p9_wire_format_inner(input: DeriveInput) -> TokenStream { let scope = Ident::new(&scope, Span::call_site()); quote! { mod #scope { - extern crate std; - use self::std::io; - use self::std::result::Result::Ok; + use std::io; + use std::result::Result::Ok; use super::#container; @@ -245,9 +237,8 @@ mod tests { let expected = quote! { mod wire_format_niijima_先輩 { - extern crate std; - use self::std::io; - use self::std::result::Result::Ok; + use std::io; + use std::result::Result::Ok; use super::Niijima_先輩; diff --git a/qcow/src/qcow.rs b/qcow/src/qcow.rs index 9015bb1..52a6cc2 100644 --- a/qcow/src/qcow.rs +++ b/qcow/src/qcow.rs @@ -2,12 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate byteorder; -extern crate libc; -extern crate remain; -#[macro_use] -extern crate sys_util; - mod qcow_raw_file; mod refcount; mod vec_cache; diff --git a/qcow_utils/src/qcow_img.rs b/qcow_utils/src/qcow_img.rs index 4f8be58..66230da 100644 --- a/qcow_utils/src/qcow_img.rs +++ b/qcow_utils/src/qcow_img.rs @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate getopts; -extern crate qcow; -extern crate sys_util; - use std::fs::OpenOptions; use std::io::{Read, Write}; diff --git a/qcow_utils/src/qcow_utils.rs b/qcow_utils/src/qcow_utils.rs index 534d886..6c8b86f 100644 --- a/qcow_utils/src/qcow_utils.rs +++ b/qcow_utils/src/qcow_utils.rs @@ -4,10 +4,6 @@ // Exported interface to basic qcow functionality to be used from C. -extern crate libc; -extern crate qcow; -extern crate sys_util; - use libc::{EBADFD, EINVAL, EIO, ENOSYS}; use std::ffi::CStr; use std::fs::{File, OpenOptions}; diff --git a/render_node_forward/Cargo.toml b/render_node_forward/Cargo.toml index accd36d..d23b46a 100644 --- a/render_node_forward/Cargo.toml +++ b/render_node_forward/Cargo.toml @@ -2,6 +2,7 @@ name = "render_node_forward" version = "0.1.0" authors = ["The Chromium OS Authors"] +edition = "2018" [lib] path = "lib.rs" diff --git a/render_node_forward/lib.rs b/render_node_forward/lib.rs index 8c04eb9..f96fdd1 100644 --- a/render_node_forward/lib.rs +++ b/render_node_forward/lib.rs @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate sys_util; - use sys_util::{GuestAddress, GuestMemory, MemoryMapping}; #[link(name = "rendernodehost")] diff --git a/resources/src/lib.rs b/resources/src/lib.rs index f300e0e..602c390 100644 --- a/resources/src/lib.rs +++ b/resources/src/lib.rs @@ -4,12 +4,6 @@ //! Manages system resources that can be allocated to VMs and their devices. -#[cfg(feature = "wl-dmabuf")] -extern crate gpu_buffer; -extern crate libc; -extern crate msg_socket; -extern crate sys_util; - mod address_allocator; mod gpu_allocator; mod system_allocator; diff --git a/src/linux.rs b/src/linux.rs index 730de9c..fcfcf94 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -60,9 +60,7 @@ use aarch64::AArch64 as Arch; use x86_64::X8664arch as Arch; #[cfg(feature = "gpu-forward")] -extern crate render_node_forward; -#[cfg(feature = "gpu-forward")] -use self::render_node_forward::*; +use render_node_forward::*; #[cfg(not(feature = "gpu-forward"))] type RenderNodeHost = (); diff --git a/src/main.rs b/src/main.rs index b1d2cb2..c8cb2ea 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,40 +4,6 @@ //! Runs a virtual machine under KVM -#[cfg(any(target_arch = "arm", target_arch = "aarch64"))] -extern crate aarch64; -extern crate arch; -extern crate audio_streams; -extern crate byteorder; -extern crate devices; -extern crate io_jail; -extern crate kernel_cmdline; -extern crate kernel_loader; -extern crate kvm; -extern crate kvm_sys; -extern crate libc; -extern crate libcras; -extern crate net_util; -extern crate qcow; -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -extern crate x86_64; -#[macro_use] -extern crate sys_util; -extern crate data_model; -#[cfg(feature = "wl-dmabuf")] -extern crate gpu_buffer; -extern crate msg_socket; -#[cfg(feature = "plugin")] -extern crate protobuf; -#[cfg(feature = "plugin")] -extern crate protos; -extern crate rand_ish; -extern crate remain; -extern crate resources; -extern crate sync; -extern crate vhost; -extern crate vm_control; - pub mod argument; pub mod linux; pub mod panic_hook; diff --git a/sys_util/poll_token_derive/poll_token_derive.rs b/sys_util/poll_token_derive/poll_token_derive.rs index 582016b..7b7baac 100644 --- a/sys_util/poll_token_derive/poll_token_derive.rs +++ b/sys_util/poll_token_derive/poll_token_derive.rs @@ -5,9 +5,6 @@ #![recursion_limit = "128"] extern crate proc_macro; -extern crate proc_macro2; -extern crate quote; -extern crate syn; use proc_macro2::{Ident, TokenStream}; use quote::quote; diff --git a/sys_util/src/capabilities.rs b/sys_util/src/capabilities.rs index 5f42ab8..90b8784 100644 --- a/sys_util/src/capabilities.rs +++ b/sys_util/src/capabilities.rs @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate libc; - use libc::{c_int, c_void}; use crate::{errno_result, Result}; diff --git a/sys_util/src/lib.rs b/sys_util/src/lib.rs index d62ec48..a1dffea 100644 --- a/sys_util/src/lib.rs +++ b/sys_util/src/lib.rs @@ -4,14 +4,6 @@ //! Small system utility modules for usage by other modules. -extern crate data_model; -extern crate libc; -extern crate syscall_defines; -#[allow(unused_imports)] -#[macro_use] -extern crate poll_token_derive; -extern crate sync; - pub mod affinity; #[macro_use] pub mod handle_eintr; @@ -226,8 +218,6 @@ pub fn fallocate( /// Reaps all child processes until there are no terminated children to reap. /// /// ``` -/// # extern crate libc; -/// # extern crate sys_util; /// fn reap_children() { /// loop { /// match sys_util::reap_child() { diff --git a/tempfile/src/lib.rs b/tempfile/src/lib.rs index c04f0f7..14f235b 100644 --- a/tempfile/src/lib.rs +++ b/tempfile/src/lib.rs @@ -5,8 +5,6 @@ //! Simplified tempfile which doesn't depend on the `rand` crate, instead using //! /dev/urandom as a source of entropy -extern crate rand_ish; - use rand_ish::urandom_str; use std::env; use std::fs; diff --git a/tests/plugins.rs b/tests/plugins.rs index e95cc07..b00309f 100644 --- a/tests/plugins.rs +++ b/tests/plugins.rs @@ -4,9 +4,6 @@ #![cfg(feature = "plugin")] -extern crate rand_ish; -extern crate sys_util; - use std::env::{current_exe, var_os}; use std::ffi::OsString; use std::fs::{remove_file, File}; diff --git a/usb_util/build.rs b/usb_util/build.rs index ee6ab30..34e14da 100644 --- a/usb_util/build.rs +++ b/usb_util/build.rs @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate pkg_config; use std::env; fn main() { diff --git a/usb_util/src/lib.rs b/usb_util/src/lib.rs index 39e098a..8755428 100644 --- a/usb_util/src/lib.rs +++ b/usb_util/src/lib.rs @@ -10,10 +10,6 @@ #[cfg_attr(feature = "cargo-clippy", allow(clippy))] mod bindings; -extern crate assertions; -extern crate data_model; -extern crate sync; - #[macro_use] pub mod error; pub mod config_descriptor; diff --git a/vhost/src/lib.rs b/vhost/src/lib.rs index e841294..917e1dc 100644 --- a/vhost/src/lib.rs +++ b/vhost/src/lib.rs @@ -2,11 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate libc; -extern crate net_util; -extern crate sys_util; -extern crate virtio_sys; - pub mod net; mod vsock; diff --git a/virtio_sys/src/lib.rs b/virtio_sys/src/lib.rs index eb74225..680d133 100644 --- a/virtio_sys/src/lib.rs +++ b/virtio_sys/src/lib.rs @@ -6,9 +6,6 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] -#[macro_use] -extern crate sys_util; - use sys_util::{ioctl_io_nr, ioctl_ior_nr, ioctl_iow_nr, ioctl_iowr_nr}; // generated with bindgen /usr/include/linux/vhost.h --no-unstable-rust --constified-enum '*' --with-derive-default diff --git a/vm_control/src/lib.rs b/vm_control/src/lib.rs index 79d95ed..ac974a1 100644 --- a/vm_control/src/lib.rs +++ b/vm_control/src/lib.rs @@ -10,14 +10,6 @@ //! The wire message format is a little-endian C-struct of fixed size, along with a file descriptor //! if the request type expects one. -extern crate byteorder; -extern crate kvm; -extern crate libc; -extern crate msg_socket; -extern crate resources; -#[macro_use] -extern crate sys_util; - use std::fmt::{self, Display}; use std::fs::File; use std::io::{Seek, SeekFrom}; diff --git a/x86_64/build.rs b/x86_64/build.rs index 77f3ae4..5f2c1eb 100644 --- a/x86_64/build.rs +++ b/x86_64/build.rs @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate cc; - fn main() { cc::Build::new().file("host_cpuid.c").compile("host_cpuid"); } diff --git a/x86_64/src/fdt.rs b/x86_64/src/fdt.rs index 8fc81ea..b072b9e 100644 --- a/x86_64/src/fdt.rs +++ b/x86_64/src/fdt.rs @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate arch; - use arch::fdt::{begin_node, end_node, finish_fdt, property_string, start_fdt, Error}; use std::fs::File; use std::io::BufRead; diff --git a/x86_64/src/lib.rs b/x86_64/src/lib.rs index 3272086..997ed40 100644 --- a/x86_64/src/lib.rs +++ b/x86_64/src/lib.rs @@ -2,21 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -extern crate arch; -extern crate byteorder; -extern crate data_model; -extern crate devices; -extern crate io_jail; -extern crate kernel_cmdline; -extern crate kernel_loader; -extern crate kvm; -extern crate kvm_sys; -extern crate libc; -extern crate remain; -extern crate resources; -extern crate sync; -extern crate sys_util; - mod fdt; const X86_64_FDT_MAX_SIZE: u64 = 0x200000; |