summary refs log tree commit diff
path: root/p9
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 /p9
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 'p9')
-rw-r--r--p9/src/lib.rs5
-rw-r--r--p9/wire_format_derive/wire_format_derive.rs17
2 files changed, 4 insertions, 18 deletions
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_先輩;