From 6b2ac5885fd1c4bdff2de90a2234d03c839f76ef Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Sun, 14 Apr 2019 15:36:24 -0400 Subject: [PATCH] rust: Stop using `extern crate` and `#[macro_use]` Rust 2018 makes this much nicer now. Closes: #1812 Approved by: lucab --- rust/src/journal.rs | 6 ++---- rust/src/lib.rs | 22 ---------------------- rust/src/progress.rs | 3 +-- rust/src/treefile.rs | 1 + rust/src/utils.rs | 2 +- 5 files changed, 5 insertions(+), 29 deletions(-) diff --git a/rust/src/journal.rs b/rust/src/journal.rs index 06e5186ba9..5bd6d21fa4 100644 --- a/rust/src/journal.rs +++ b/rust/src/journal.rs @@ -16,11 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -extern crate systemd; - -use self::systemd::id128::Id128; -use self::systemd::journal; use failure::Fallible; +use systemd::id128::Id128; +use systemd::journal; static OSTREE_FINALIZE_STAGED_SERVICE: &'static str = "ostree-finalize-staged.service"; static OSTREE_DEPLOYMENT_FINALIZING_MSG_ID: &'static str = "e8646cd63dff4625b77909a8e7a40994"; diff --git a/rust/src/lib.rs b/rust/src/lib.rs index b9994ec797..758bd29f0d 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -16,28 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -extern crate c_utf8; -extern crate clap; -extern crate curl; -#[macro_use] -extern crate failure; -extern crate gio_sys; -extern crate glib; -extern crate glib_sys; -extern crate indicatif; -extern crate libc; -extern crate openat; -extern crate rayon; -extern crate tempfile; - -#[macro_use] -extern crate lazy_static; -#[macro_use] -extern crate serde_derive; -extern crate serde; -extern crate serde_json; -extern crate serde_yaml; - // pub(crate) utilities mod ffiutil; mod openat_utils; diff --git a/rust/src/progress.rs b/rust/src/progress.rs index 85b4e4b368..b510f9887f 100644 --- a/rust/src/progress.rs +++ b/rust/src/progress.rs @@ -16,9 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -extern crate indicatif; - use indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle}; +use lazy_static::lazy_static; use std::borrow::Cow; use std::sync::Mutex; diff --git a/rust/src/treefile.rs b/rust/src/treefile.rs index 9e25645695..926d4c4670 100644 --- a/rust/src/treefile.rs +++ b/rust/src/treefile.rs @@ -24,6 +24,7 @@ use c_utf8::CUtf8Buf; use failure::Fallible; use failure::ResultExt; use openat; +use serde_derive::{Deserialize, Serialize}; use serde_json; use serde_yaml; use std::collections::HashMap; diff --git a/rust/src/utils.rs b/rust/src/utils.rs index 585015429f..39d9ea802b 100644 --- a/rust/src/utils.rs +++ b/rust/src/utils.rs @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -use failure::Fallible; +use failure::{bail, Fallible}; use std::collections::HashMap; use std::io::prelude::*; use std::{fs, io};