From c01a383d1a0c55a91912f280984d59ca2c0db832 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Mon, 10 Dec 2018 17:28:25 +0100 Subject: [PATCH] Remove macro use extern crates Since the Rust 2018 edition allows importing macros directly, all uses of `#[macro_use] extern crate` have been removed from the linux build. The `log` and `serde` crate have been excluded from that right now, since they are so frequently used in the codebase. --- src/cli.rs | 3 ++- src/grid/storage.rs | 2 ++ src/lib.rs | 4 ---- src/main.rs | 26 ++++++++++---------------- src/term/cell.rs | 2 ++ src/term/mod.rs | 2 ++ 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 2eeb0c0b..af8346f9 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. use ::log; -use clap::{Arg, App}; +use clap::{Arg, App, crate_name, crate_version, crate_authors, crate_description}; + use crate::index::{Line, Column}; use crate::config::{Dimensions, Shell}; use crate::window::{DEFAULT_TITLE, DEFAULT_CLASS}; diff --git a/src/grid/storage.rs b/src/grid/storage.rs index 6a8253e3..19c1636d 100644 --- a/src/grid/storage.rs +++ b/src/grid/storage.rs @@ -14,6 +14,8 @@ use std::ops::{Index, IndexMut}; use std::slice; +use static_assertions::assert_eq_size; + use crate::index::Line; use super::Row; diff --git a/src/lib.rs b/src/lib.rs index 31130608..d52c457b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,11 +17,8 @@ #![cfg_attr(feature = "nightly", feature(core_intrinsics))] #![cfg_attr(all(test, feature = "bench"), feature(test))] -#[macro_use] extern crate bitflags; -#[macro_use] extern crate clap; #[macro_use] extern crate log; #[macro_use] extern crate serde_derive; -#[macro_use] extern crate static_assertions; #[cfg(windows)] extern crate mio_named_pipes; @@ -40,7 +37,6 @@ extern crate objc; #[macro_use] pub mod macros; - pub mod ansi; pub mod cli; pub mod config; diff --git a/src/main.rs b/src/main.rs index 212ab79e..fea14b5f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,13 +23,13 @@ // See https://msdn.microsoft.com/en-us/library/4cc7ya5b.aspx for more details. #![windows_subsystem = "windows"] -#[macro_use] -extern crate alacritty; - -#[macro_use] -extern crate log; #[cfg(target_os = "macos")] -extern crate dirs; +use dirs; + +#[cfg(windows)] +use winapi::um::wincon::{AttachConsole, FreeConsole, ATTACH_PARENT_PROCESS}; + +use log::{info, error}; use std::error::Error; use std::sync::Arc; @@ -40,18 +40,12 @@ use std::env; #[cfg(not(windows))] use std::os::unix::io::AsRawFd; -#[cfg(windows)] -extern crate winapi; -#[cfg(windows)] -use winapi::um::wincon::{AttachConsole, FreeConsole, ATTACH_PARENT_PROCESS}; - -use alacritty::cli; -use alacritty::config::{self, Config, Error as ConfigError}; -use alacritty::display::Display; -use alacritty::event; -use alacritty::event_loop::{self, EventLoop, Msg}; #[cfg(target_os = "macos")] use alacritty::locale; +use alacritty::{cli, event, die}; +use alacritty::config::{self, Config, Error as ConfigError}; +use alacritty::display::Display; +use alacritty::event_loop::{self, EventLoop, Msg}; use alacritty::logging::{self, LoggerProxy}; use alacritty::sync::FairMutex; use alacritty::term::Term; diff --git a/src/term/cell.rs b/src/term/cell.rs index 45bfdf44..259b6ac1 100644 --- a/src/term/cell.rs +++ b/src/term/cell.rs @@ -11,6 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +use bitflags::bitflags; + use crate::ansi::{NamedColor, Color}; use crate::grid; use crate::index::Column; diff --git a/src/term/mod.rs b/src/term/mod.rs index c0989add..fba509f5 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -499,6 +499,8 @@ impl<'a> Iterator for RenderableCellsIter<'a> { } pub mod mode { + use bitflags::bitflags; + bitflags! { pub struct TermMode: u16 { const SHOW_CURSOR = 0b00_0000_0000_0001;