Fix Rust 2018 edition idioms
diff --git a/build.rs b/build.rs
index 22799c9..4036dad 100644
--- a/build.rs
+++ b/build.rs
@@ -12,15 +12,13 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 #[cfg(windows)]
-extern crate embed_resource;
+use embed_resource;
 #[cfg(windows)]
-extern crate tempfile;
+use tempfile;
 #[cfg(windows)]
-extern crate reqwest;
+use reqwest;
 #[cfg(windows)]
-extern crate zip;
-
-extern crate gl_generator;
+use zip;
 
 use gl_generator::{Api, Fallbacks, GlobalGenerator, Profile, Registry};
 
diff --git a/src/ansi.rs b/src/ansi.rs
index eb36454..db8022e 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -112,7 +112,7 @@
 ///
 /// Processor creates a Performer when running advance and passes the Performer
 /// to `vte::Parser`.
-struct Performer<'a, H: Handler + TermInfo + 'a, W: io::Write + 'a> {
+struct Performer<'a, H: Handler + TermInfo, W: io::Write> {
     _state: &'a mut ProcessorState,
     handler: &'a mut H,
     writer: &'a mut W
@@ -1225,7 +1225,7 @@
                 *i += 2;
                 let idx = attrs[*i];
                 match idx {
-                    0 ... 255 => {
+                    0 ..= 255 => {
                         Some(Color::Indexed(idx as u8))
                     },
                     _ => {
diff --git a/src/cli.rs b/src/cli.rs
index 6a41f5e..2eeb0c0 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -11,7 +11,7 @@
 // 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.
-extern crate log;
+use ::log;
 use clap::{Arg, App};
 use crate::index::{Line, Column};
 use crate::config::{Dimensions, Shell};
@@ -186,11 +186,11 @@
         self.dimensions
     }
 
-    pub fn command(&self) -> Option<&Shell> {
+    pub fn command(&self) -> Option<&Shell<'_>> {
         self.command.as_ref()
     }
 
-    pub fn config_path(&self) -> Option<Cow<Path>> {
+    pub fn config_path(&self) -> Option<Cow<'_, Path>> {
         self.config.as_ref().map(|p| Cow::Borrowed(p.as_path()))
     }
 }
diff --git a/src/config.rs b/src/config.rs
index b1d3306..39a5c02 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -296,7 +296,7 @@
         impl<'de> Visitor<'de> for DecorationsVisitor {
             type Value = Decorations;
 
-            fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 f.write_str("Some subset of full|transparent|buttonless|none")
             }
 
@@ -709,7 +709,7 @@
         impl<'a> Visitor<'a> for ModsVisitor {
             type Value = ModsWrapper;
 
-            fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 f.write_str("Some subset of Command|Shift|Super|Alt|Option|Control")
             }
 
@@ -752,7 +752,7 @@
         impl<'a> Visitor<'a> for ActionVisitor {
             type Value = ActionWrapper;
 
-            fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 f.write_str("Paste, Copy, PasteSelection, IncreaseFontSize, DecreaseFontSize, \
                             ResetFontSize, ScrollPageUp, ScrollPageDown, ScrollToTop, \
                             ScrollToBottom, ClearHistory, Hide, ClearLogNotice or Quit")
@@ -827,7 +827,7 @@
         impl<'a> Visitor<'a> for ModeVisitor {
             type Value = ModeWrapper;
 
-            fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 f.write_str("Combination of AppCursor | AppKeypad, possibly with negation (~)")
             }
 
@@ -873,7 +873,7 @@
         impl<'a> Visitor<'a> for MouseButtonVisitor {
             type Value = MouseButton;
 
-            fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 f.write_str("Left, Right, Middle, or a number")
             }
 
@@ -967,7 +967,7 @@
                 impl<'a> Visitor<'a> for FieldVisitor {
                     type Value = Field;
 
-                    fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
+                    fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                         f.write_str("binding fields")
                     }
 
@@ -995,7 +995,7 @@
         impl<'a> Visitor<'a> for RawBindingVisitor {
             type Value = RawBinding;
 
-            fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 f.write_str("binding specification")
             }
 
@@ -1357,7 +1357,7 @@
     impl<'a> Visitor<'a> for RgbVisitor {
         type Value = Rgb;
 
-        fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
             f.write_str("Hex colors spec like 'ffaabb'")
         }
 
@@ -1416,7 +1416,7 @@
 }
 
 impl ::std::error::Error for Error {
-    fn cause(&self) -> Option<&::std::error::Error> {
+    fn cause(&self) -> Option<&dyn (::std::error::Error)> {
         match *self {
             Error::NotFound | Error::Empty => None,
             Error::ReadingEnvHome(ref err) => Some(err),
@@ -1437,7 +1437,7 @@
 }
 
 impl ::std::fmt::Display for Error {
-    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         match *self {
             Error::NotFound | Error::Empty => write!(f, "{}", ::std::error::Error::description(self)),
             Error::ReadingEnvHome(ref err) => {
@@ -1625,7 +1625,7 @@
             .map(|p| p.as_path())
     }
 
-    pub fn shell(&self) -> Option<&Shell> {
+    pub fn shell(&self) -> Option<&Shell<'_>> {
         self.shell.as_ref()
     }
 
@@ -1831,7 +1831,7 @@
         {
             type Value = f64;
 
-            fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 f.write_str("f64 or u64")
             }
 
diff --git a/src/display.rs b/src/display.rs
index 40c85b2..99889c6 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -44,7 +44,7 @@
 }
 
 impl ::std::error::Error for Error {
-    fn cause(&self) -> Option<&::std::error::Error> {
+    fn cause(&self) -> Option<&dyn (::std::error::Error)> {
         match *self {
             Error::Window(ref err) => Some(err),
             Error::Font(ref err) => Some(err),
@@ -62,7 +62,7 @@
 }
 
 impl ::std::fmt::Display for Error {
-    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         match *self {
             Error::Window(ref err) => err.fmt(f),
             Error::Font(ref err) => err.fmt(f),
@@ -292,9 +292,9 @@
     /// Process pending resize events
     pub fn handle_resize(
         &mut self,
-        terminal: &mut MutexGuard<Term>,
+        terminal: &mut MutexGuard<'_, Term>,
         config: &Config,
-        items: &mut [&mut OnResize],
+        items: &mut [&mut dyn OnResize],
     ) {
         // Resize events new_size and are handled outside the poll_events
         // iterator. This has the effect of coalescing multiple resize
diff --git a/src/event.rs b/src/event.rs
index b0b6b33..39ed25f 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -34,7 +34,7 @@
     fn notify<B: Into<Cow<'static, [u8]>>>(&mut self, _: B);
 }
 
-pub struct ActionContext<'a, N: 'a> {
+pub struct ActionContext<'a, N> {
     pub notifier: &'a mut N,
     pub terminal: &'a mut Term,
     pub size_info: &'a mut SizeInfo,
@@ -456,7 +456,7 @@
         {
             // Ditto on lazy initialization for context and processor.
             let context;
-            let mut processor: input::Processor<ActionContext<N>>;
+            let mut processor: input::Processor<'_, ActionContext<'_, N>>;
 
             let print_events = self.print_events;
 
diff --git a/src/grid/mod.rs b/src/grid/mod.rs
index f39bc68..a00fed4 100644
--- a/src/grid/mod.rs
+++ b/src/grid/mod.rs
@@ -99,7 +99,7 @@
     max_scroll_limit: usize,
 }
 
-pub struct GridIterator<'a, T: 'a> {
+pub struct GridIterator<'a, T> {
     /// Immutable grid reference
     grid: &'a Grid<T>,
 
@@ -411,7 +411,7 @@
         self.lines
     }
 
-    pub fn display_iter(&self) -> DisplayIter<T> {
+    pub fn display_iter(&self) -> DisplayIter<'_, T> {
         DisplayIter::new(self)
     }
 
@@ -454,7 +454,7 @@
         self.raw.truncate();
     }
 
-    pub fn iter_from(&self, point: Point<usize>) -> GridIterator<T> {
+    pub fn iter_from(&self, point: Point<usize>) -> GridIterator<'_, T> {
         GridIterator {
             grid: self,
             cur: point,
@@ -557,7 +557,7 @@
 /// A subset of lines in the grid
 ///
 /// May be constructed using Grid::region(..)
-pub struct Region<'a, T: 'a> {
+pub struct Region<'a, T> {
     start: Line,
     end: Line,
     raw: &'a Storage<T>,
@@ -566,7 +566,7 @@
 /// A mutable subset of lines in the grid
 ///
 /// May be constructed using Grid::region_mut(..)
-pub struct RegionMut<'a, T: 'a> {
+pub struct RegionMut<'a, T> {
     start: Line,
     end: Line,
     raw: &'a mut Storage<T>,
@@ -585,14 +585,14 @@
 
 pub trait IndexRegion<I, T> {
     /// Get an immutable region of Self
-    fn region(&self, _: I) -> Region<T>;
+    fn region(&self, _: I) -> Region<'_, T>;
 
     /// Get a mutable region of Self
-    fn region_mut(&mut self, _: I) -> RegionMut<T>;
+    fn region_mut(&mut self, _: I) -> RegionMut<'_, T>;
 }
 
 impl<T> IndexRegion<Range<Line>, T> for Grid<T> {
-    fn region(&self, index: Range<Line>) -> Region<T> {
+    fn region(&self, index: Range<Line>) -> Region<'_, T> {
         assert!(index.start < self.num_lines());
         assert!(index.end <= self.num_lines());
         assert!(index.start <= index.end);
@@ -602,7 +602,7 @@
             raw: &self.raw
         }
     }
-    fn region_mut(&mut self, index: Range<Line>) -> RegionMut<T> {
+    fn region_mut(&mut self, index: Range<Line>) -> RegionMut<'_, T> {
         assert!(index.start < self.num_lines());
         assert!(index.end <= self.num_lines());
         assert!(index.start <= index.end);
@@ -615,7 +615,7 @@
 }
 
 impl<T> IndexRegion<RangeTo<Line>, T> for Grid<T> {
-    fn region(&self, index: RangeTo<Line>) -> Region<T> {
+    fn region(&self, index: RangeTo<Line>) -> Region<'_, T> {
         assert!(index.end <= self.num_lines());
         Region {
             start: Line(0),
@@ -623,7 +623,7 @@
             raw: &self.raw
         }
     }
-    fn region_mut(&mut self, index: RangeTo<Line>) -> RegionMut<T> {
+    fn region_mut(&mut self, index: RangeTo<Line>) -> RegionMut<'_, T> {
         assert!(index.end <= self.num_lines());
         RegionMut {
             start: Line(0),
@@ -634,7 +634,7 @@
 }
 
 impl<T> IndexRegion<RangeFrom<Line>, T> for Grid<T> {
-    fn region(&self, index: RangeFrom<Line>) -> Region<T> {
+    fn region(&self, index: RangeFrom<Line>) -> Region<'_, T> {
         assert!(index.start < self.num_lines());
         Region {
             start: index.start,
@@ -642,7 +642,7 @@
             raw: &self.raw
         }
     }
-    fn region_mut(&mut self, index: RangeFrom<Line>) -> RegionMut<T> {
+    fn region_mut(&mut self, index: RangeFrom<Line>) -> RegionMut<'_, T> {
         assert!(index.start < self.num_lines());
         RegionMut {
             start: index.start,
@@ -653,7 +653,7 @@
 }
 
 impl<T> IndexRegion<RangeFull, T> for Grid<T> {
-    fn region(&self, _: RangeFull) -> Region<T> {
+    fn region(&self, _: RangeFull) -> Region<'_, T> {
         Region {
             start: Line(0),
             end: self.num_lines(),
@@ -661,7 +661,7 @@
         }
     }
 
-    fn region_mut(&mut self, _: RangeFull) -> RegionMut<T> {
+    fn region_mut(&mut self, _: RangeFull) -> RegionMut<'_, T> {
         RegionMut {
             start: Line(0),
             end: self.num_lines(),
@@ -670,13 +670,13 @@
     }
 }
 
-pub struct RegionIter<'a, T: 'a> {
+pub struct RegionIter<'a, T> {
     end: Line,
     cur: Line,
     raw: &'a Storage<T>,
 }
 
-pub struct RegionIterMut<'a, T: 'a> {
+pub struct RegionIterMut<'a, T> {
     end: Line,
     cur: Line,
     raw: &'a mut Storage<T>,
@@ -741,7 +741,7 @@
 // -------------------------------------------------------------------------------------------------
 
 /// Iterates over the visible area accounting for buffer transform
-pub struct DisplayIter<'a, T: 'a> {
+pub struct DisplayIter<'a, T> {
     grid: &'a Grid<T>,
     offset: usize,
     limit: usize,
diff --git a/src/grid/row.rs b/src/grid/row.rs
index 0db0c0c..72c79b0 100644
--- a/src/grid/row.rs
+++ b/src/grid/row.rs
@@ -85,7 +85,7 @@
         self.inner.len()
     }
 
-    pub fn iter(&self) -> slice::Iter<T> {
+    pub fn iter(&self) -> slice::Iter<'_, T> {
         self.inner.iter()
     }
 }
diff --git a/src/index.rs b/src/index.rs
index 8f998bf..93f1727 100644
--- a/src/index.rs
+++ b/src/index.rs
@@ -77,7 +77,7 @@
 pub struct Line(pub usize);
 
 impl fmt::Display for Line {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(f, "{}", self.0)
     }
 }
@@ -89,7 +89,7 @@
 pub struct Column(pub usize);
 
 impl fmt::Display for Column {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(f, "{}", self.0)
     }
 }
@@ -101,7 +101,7 @@
 pub struct Linear(pub usize);
 
 impl fmt::Display for Linear {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(f, "Linear({})", self.0)
     }
 }
diff --git a/src/input.rs b/src/input.rs
index 9a3d9f6..07887ad 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -939,7 +939,7 @@
                     processor.mouse_input(state, button, modifiers);
                 };
 
-                assert!(match mouse.click_state {
+                assert!(match processor.ctx.mouse.click_state {
                     $end_state => processor.ctx.last_action == $last_action,
                     _ => false
                 });
diff --git a/src/lib.rs b/src/lib.rs
index 61f61cc..3113060 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -23,10 +23,6 @@
 #[macro_use] extern crate serde_derive;
 #[macro_use] extern crate static_assertions;
 
-#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly",
-          target_os = "openbsd"))]
-extern crate x11_dl;
-
 #[cfg(windows)]
 extern crate mio_named_pipes;
 #[cfg(windows)]
@@ -42,30 +38,6 @@
 #[macro_use]
 extern crate objc;
 
-extern crate arraydeque;
-extern crate cgmath;
-extern crate copypasta;
-extern crate env_logger;
-extern crate errno;
-extern crate fnv;
-extern crate font;
-extern crate glutin;
-extern crate libc;
-extern crate mio;
-extern crate mio_more;
-extern crate notify;
-extern crate parking_lot;
-extern crate serde;
-extern crate serde_json;
-extern crate serde_yaml;
-extern crate unicode_width;
-extern crate vte;
-extern crate xdg;
-extern crate base64;
-extern crate terminfo;
-extern crate url;
-extern crate time;
-
 #[macro_use]
 pub mod macros;
 
diff --git a/src/logging.rs b/src/logging.rs
index eb9016b..1767724 100644
--- a/src/logging.rs
+++ b/src/logging.rs
@@ -120,11 +120,11 @@
 }
 
 impl log::Log for Logger {
-    fn enabled(&self, metadata: &log::Metadata) -> bool {
+    fn enabled(&self, metadata: &log::Metadata<'_>) -> bool {
         metadata.level() <= self.level
     }
 
-    fn log(&self, record: &log::Record) {
+    fn log(&self, record: &log::Record<'_>) {
         if self.enabled(record.metadata()) && record.target().starts_with("alacritty") {
             let msg = format!(
                 "[{}] [{}] {}\n",
diff --git a/src/main.rs b/src/main.rs
index 9d57f08..212ab79 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -118,7 +118,7 @@
     mut config: Config,
     options: &cli::Options,
     mut logger_proxy: LoggerProxy,
-) -> Result<(), Box<Error>> {
+) -> Result<(), Box<dyn Error>> {
     info!("Welcome to Alacritty.");
     if let Some(config_path) = config.path() {
         info!("Configuration loaded from {}", config_path.display());
diff --git a/src/meter.rs b/src/meter.rs
index 952dedf..32650e4 100644
--- a/src/meter.rs
+++ b/src/meter.rs
@@ -86,7 +86,7 @@
     }
 
     /// Get a sampler
-    pub fn sampler(&mut self) -> Sampler {
+    pub fn sampler(&mut self) -> Sampler<'_> {
         Sampler::new(self)
     }
 
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs
index 85de1fd..02d3152 100644
--- a/src/renderer/mod.rs
+++ b/src/renderer/mod.rs
@@ -65,7 +65,7 @@
 }
 
 impl ::std::error::Error for Error {
-    fn cause(&self) -> Option<&::std::error::Error> {
+    fn cause(&self) -> Option<&dyn (::std::error::Error)> {
         match *self {
             Error::ShaderCreation(ref err) => Some(err),
         }
@@ -79,7 +79,7 @@
 }
 
 impl ::std::fmt::Display for Error {
-    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         match *self {
             Error::ShaderCreation(ref err) => {
                 write!(f, "There was an error initializing the shaders: {}", err)
@@ -660,7 +660,7 @@
         func: F,
     ) -> T
     where
-        F: FnOnce(RenderApi) -> T,
+        F: FnOnce(RenderApi<'_>) -> T,
     {
         while let Ok(msg) = self.rx.try_recv() {
             match msg {
@@ -704,7 +704,7 @@
 
     pub fn with_loader<F, T>(&mut self, func: F) -> T
     where
-        F: FnOnce(LoaderApi) -> T,
+        F: FnOnce(LoaderApi<'_>) -> T,
     {
         unsafe {
             gl::ActiveTexture(gl::TEXTURE0);
@@ -897,7 +897,7 @@
             };
 
             // Add cell to batch
-            let glyph = glyph_cache.get(glyph_key, self); // borrowck multiple mutable borrows
+            let glyph = glyph_cache.get(glyph_key, self);
             self.add_render_item(&cell, glyph);
 
             // Render zero-width characters
@@ -1288,7 +1288,7 @@
 }
 
 impl ::std::error::Error for ShaderCreationError {
-    fn cause(&self) -> Option<&::std::error::Error> {
+    fn cause(&self) -> Option<&dyn (::std::error::Error)> {
         match *self {
             ShaderCreationError::Io(ref err) => Some(err),
             _ => None,
@@ -1305,7 +1305,7 @@
 }
 
 impl ::std::fmt::Display for ShaderCreationError {
-    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         match *self {
             ShaderCreationError::Io(ref err) => write!(f, "couldn't read shader: {}", err),
             ShaderCreationError::Compile(ref _path, ref s) => {
diff --git a/src/sync.rs b/src/sync.rs
index e314b7e..06d6cea 100644
--- a/src/sync.rs
+++ b/src/sync.rs
@@ -38,7 +38,7 @@
     }
 
     /// Lock the mutex
-    pub fn lock(&self) -> MutexGuard<T> {
+    pub fn lock(&self) -> MutexGuard<'_, T> {
         // Must bind to a temporary or the lock will be freed before going
         // into data.lock()
         let _next = self.next.lock();
diff --git a/src/term/color.rs b/src/term/color.rs
index 7211b04..638cbd7 100644
--- a/src/term/color.rs
+++ b/src/term/color.rs
@@ -154,7 +154,7 @@
 }
 
 impl fmt::Debug for List {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.write_str("List[..]")
     }
 }
diff --git a/src/term/mod.rs b/src/term/mod.rs
index fe6724c..c0989ad 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -391,9 +391,9 @@
                     cell.flags & Flags::DIM_BOLD,
                     idx
                 ) {
-                    (true,  self::cell::Flags::BOLD, 0...7)  => idx as usize + 8,
-                    (false, self::cell::Flags::DIM,  8...15) => idx as usize - 8,
-                    (false, self::cell::Flags::DIM,  0...7)  => idx as usize + 260,
+                    (true,  self::cell::Flags::BOLD, 0..=7)  => idx as usize + 8,
+                    (false, self::cell::Flags::DIM,  8..=15) => idx as usize - 8,
+                    (false, self::cell::Flags::DIM,  0..=7)  => idx as usize + 260,
                     _ => idx as usize,
                 };
 
@@ -1128,7 +1128,7 @@
         &'b self,
         config: &'b Config,
         window_focused: bool,
-    ) -> RenderableCellsIter {
+    ) -> RenderableCellsIter<'_> {
         let alt_screen = self.mode.contains(TermMode::ALT_SCREEN);
         let selection = self.grid.selection.as_ref()
             .and_then(|s| s.to_span(self, alt_screen))
@@ -2068,7 +2068,7 @@
 
 #[cfg(test)]
 mod tests {
-    extern crate serde_json;
+    use serde_json;
 
     use super::{Cell, Term, SizeInfo};
     use crate::term::{cell, Search};
@@ -2419,8 +2419,8 @@
     use std::mem;
     use std::path::Path;
 
-    use grid::Grid;
-    use config::Config;
+    use crate::grid::Grid;
+    use crate::config::Config;
 
     use super::{SizeInfo, Term};
     use super::cell::Cell;
diff --git a/src/tty/mod.rs b/src/tty/mod.rs
index ef6b9db..cedb010 100644
--- a/src/tty/mod.rs
+++ b/src/tty/mod.rs
@@ -40,7 +40,7 @@
     fn register(
         &mut self,
         _: &mio::Poll,
-        _: &mut Iterator<Item = &usize>,
+        _: &mut dyn Iterator<Item = &usize>,
         _: mio::Ready,
         _: mio::PollOpt,
     ) -> io::Result<()>;
diff --git a/src/tty/unix.rs b/src/tty/unix.rs
index b1125fe..b341638 100644
--- a/src/tty/unix.rs
+++ b/src/tty/unix.rs
@@ -149,7 +149,7 @@
 /// # Unsafety
 ///
 /// If `buf` is changed while `Passwd` is alive, bad thing will almost certainly happen.
-fn get_pw_entry(buf: &mut [i8; 1024]) -> Passwd {
+fn get_pw_entry(buf: &mut [i8; 1024]) -> Passwd<'_> {
     // Create zeroed passwd struct
     let mut entry: libc::passwd = unsafe { ::std::mem::uninitialized() };
 
@@ -329,7 +329,7 @@
     fn register(
         &mut self,
         poll: &mio::Poll,
-        token: &mut Iterator<Item = &usize>,
+        token: &mut dyn Iterator<Item = &usize>,
         interest: mio::Ready,
         poll_opts: mio::PollOpt,
     ) -> io::Result<()> {
diff --git a/src/util.rs b/src/util.rs
index 3b981aa..0b3b664 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -50,13 +50,13 @@
                 pub struct $s<T>(pub T);
 
                 impl<T: fmt::Display> fmt::Display for $s<T> {
-                    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+                    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                         write!(f, concat!("\x1b[", $color, "m{}\x1b[0m"), self.0)
                     }
                 }
 
                 impl<T: fmt::Debug> fmt::Debug for $s<T> {
-                    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+                    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                         write!(f, concat!("\x1b[", $color, "m{:?}\x1b[0m"), self.0)
                     }
                 }
diff --git a/src/window.rs b/src/window.rs
index 37905b0..ebff59c 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -93,7 +93,7 @@
 }
 
 impl ::std::error::Error for Error {
-    fn cause(&self) -> Option<&::std::error::Error> {
+    fn cause(&self) -> Option<&dyn (::std::error::Error)> {
         match *self {
             Error::ContextCreation(ref err) => Some(err),
             Error::Context(ref err) => Some(err),
@@ -109,7 +109,7 @@
 }
 
 impl Display for Error {
-    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         match *self {
             Error::ContextCreation(ref err) => write!(f, "Error creating GL context; {}", err),
             Error::Context(ref err) => write!(f, "Error operating on render context; {}", err),
diff --git a/tests/ref.rs b/tests/ref.rs
index 6546921..1ab012d 100644
--- a/tests/ref.rs
+++ b/tests/ref.rs
@@ -1,7 +1,6 @@
 #[macro_use]
 extern crate serde_derive;
-extern crate serde_json as json;
-extern crate alacritty;
+use serde_json as json;
 
 use std::fs::File;
 use std::io::{self, Read};