summary refs log tree commit diff
path: root/bit_field
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@chromium.org>2019-04-11 14:30:00 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-15 02:06:08 -0700
commitaecf9a4dee6c004bceabf268a5b36d24c3744ca6 (patch)
treef43a4fae670c5e3366d30d405b8f603d44a6464f /bit_field
parent633426a8fc20a5eef402e159d53228aae13bbaa5 (diff)
downloadcrosvm-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>
Diffstat (limited to 'bit_field')
-rw-r--r--bit_field/bit_field_derive/bit_field_derive.rs8
-rw-r--r--bit_field/src/lib.rs24
-rw-r--r--bit_field/tests/test_enum.rs2
-rw-r--r--bit_field/tests/test_tuple_struct.rs2
4 files changed, 1 insertions, 35 deletions
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]