aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2018-12-09 17:04:02 +0100
committerChristian Duerr <contact@christianduerr.com>2018-12-10 17:40:23 +0100
commit7ec36f2626aa601f4b1cd85e9712bc81903e6170 (patch)
tree214bfca4eae72490156eb666a0fba3c5731961a5
parent926b92e864cbda9105f383df7adc3f73aef05ca0 (diff)
downloadalacritty-7ec36f2626aa601f4b1cd85e9712bc81903e6170.tar.gz
alacritty-7ec36f2626aa601f4b1cd85e9712bc81903e6170.zip
Fix Rust 2018 edition idioms
-rw-r--r--build.rs10
-rw-r--r--src/ansi.rs4
-rw-r--r--src/cli.rs6
-rw-r--r--src/config.rs24
-rw-r--r--src/display.rs8
-rw-r--r--src/event.rs4
-rw-r--r--src/grid/mod.rs36
-rw-r--r--src/grid/row.rs2
-rw-r--r--src/index.rs6
-rw-r--r--src/input.rs2
-rw-r--r--src/lib.rs28
-rw-r--r--src/logging.rs4
-rw-r--r--src/main.rs2
-rw-r--r--src/meter.rs2
-rw-r--r--src/renderer/mod.rs14
-rw-r--r--src/sync.rs2
-rw-r--r--src/term/color.rs2
-rw-r--r--src/term/mod.rs14
-rw-r--r--src/tty/mod.rs2
-rw-r--r--src/tty/unix.rs4
-rw-r--r--src/util.rs4
-rw-r--r--src/window.rs4
-rw-r--r--tests/ref.rs3
23 files changed, 78 insertions, 109 deletions
diff --git a/build.rs b/build.rs
index 22799c95..4036dad2 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 eb36454b..db8022e2 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -112,7 +112,7 @@ struct ProcessorState {
///
/// 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 @@ fn parse_color(attrs: &[i64], i: &mut usize) -> Option<Color> {
*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 6a41f5ea..2eeb0c0b 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 @@ impl Options {
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 b1d33061..39a5c024 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -296,7 +296,7 @@ impl<'de> Deserialize<'de> for Decorations {
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> de::Deserialize<'a> for ModsWrapper {
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> de::Deserialize<'a> for ActionWrapper {
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> de::Deserialize<'a> for ModeWrapper {
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> de::Deserialize<'a> for MouseButton {
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> de::Deserialize<'a> for RawBinding {
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> de::Deserialize<'a> for RawBinding {
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 @@ fn rgb_from_hex<'a, D>(deserializer: D) -> ::std::result::Result<Rgb, D::Error>
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 FromStr for Rgb {
}
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::error::Error for Error {
}
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 @@ impl Config {
.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 @@ impl DeserializeSize for Size {
{
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 40c85b20..99889c67 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -44,7 +44,7 @@ pub enum Error {
}
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::error::Error for Error {
}
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 @@ impl Display {
/// 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 b0b6b333..39ed25f6 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -34,7 +34,7 @@ pub trait Notify {
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 @@ impl<N: Notify> Processor<N> {
{
// 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 f39bc686..a00fed40 100644
--- a/src/grid/mod.rs
+++ b/src/grid/mod.rs
@@ -99,7 +99,7 @@ pub struct Grid<T> {
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 @@ impl<T> Grid<T> {
self.lines
}
- pub fn display_iter(&self) -> DisplayIter<T> {
+ pub fn display_iter(&self) -> DisplayIter<'_, T> {
DisplayIter::new(self)
}
@@ -454,7 +454,7 @@ impl<T> Grid<T> {
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 @@ impl<'point, T> IndexMut<&'point Point> for Grid<T> {
/// 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 @@ pub struct Region<'a, T: 'a> {
/// 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 @@ impl<'a, T> RegionMut<'a, T> {
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 @@ impl<T> IndexRegion<Range<Line>, T> for Grid<T> {
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<Range<Line>, T> for Grid<T> {
}
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 @@ impl<T> IndexRegion<RangeTo<Line>, T> for Grid<T> {
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<RangeTo<Line>, T> for Grid<T> {
}
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 @@ impl<T> IndexRegion<RangeFrom<Line>, T> for Grid<T> {
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<RangeFrom<Line>, T> for Grid<T> {
}
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 @@ impl<T> IndexRegion<RangeFull, T> for Grid<T> {
}
}
- 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 @@ impl<T> IndexRegion<RangeFull, T> for Grid<T> {
}
}
-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 @@ impl<'a, T> Iterator for RegionIterMut<'a, T> {
// -------------------------------------------------------------------------------------------------
/// 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 0db0c0c1..72c79b02 100644
--- a/src/grid/row.rs
+++ b/src/grid/row.rs
@@ -85,7 +85,7 @@ impl<T> Row<T> {
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 8f998bf0..93f1727e 100644
--- a/src/index.rs
+++ b/src/index.rs
@@ -77,7 +77,7 @@ impl From<Point> for Point<usize> {
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 @@ impl fmt::Display for Line {
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 @@ impl fmt::Display for Column {
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 9a3d9f6d..07887ad9 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -939,7 +939,7 @@ mod tests {
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 61f61ccf..31130608 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 @@ extern crate image;
#[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 eb9016bf..1767724c 100644
--- a/src/logging.rs
+++ b/src/logging.rs
@@ -120,11 +120,11 @@ impl Logger {
}
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 9d57f086..212ab79e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -118,7 +118,7 @@ fn run(
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 952dedf8..32650e4d 100644
--- a/src/meter.rs
+++ b/src/meter.rs
@@ -86,7 +86,7 @@ impl Meter {
}
/// 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 85de1fd6..02d31524 100644
--- a/src/renderer/mod.rs
+++ b/src/renderer/mod.rs
@@ -65,7 +65,7 @@ pub enum Error {
}
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::error::Error for Error {
}
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 @@ impl QuadRenderer {
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 @@ impl QuadRenderer {
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 @@ impl<'a> RenderApi<'a> {
};
// 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 @@ pub enum ShaderCreationError {
}
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::error::Error for ShaderCreationError {
}
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 e314b7e8..06d6cea4 100644
--- a/src/sync.rs
+++ b/src/sync.rs
@@ -38,7 +38,7 @@ impl<T> FairMutex<T> {
}
/// 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 7211b043..638cbd76 100644
--- a/src/term/color.rs
+++ b/src/term/color.rs
@@ -154,7 +154,7 @@ impl List {
}
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 fe6724c9..c0989add 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -391,9 +391,9 @@ impl<'a> RenderableCellsIter<'a> {
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 @@ impl Term {
&'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 @@ impl ansi::Handler for Term {
#[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 @@ mod benches {
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 ef6b9db0..cedb010e 100644
--- a/src/tty/mod.rs
+++ b/src/tty/mod.rs
@@ -40,7 +40,7 @@ pub trait EventedReadWrite {
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 b1125fe5..b341638f 100644
--- a/src/tty/unix.rs
+++ b/src/tty/unix.rs
@@ -149,7 +149,7 @@ struct Passwd<'a> {
/// # 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 @@ impl EventedReadWrite for Pty {
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 3b981aa6..0b3b6644 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -50,13 +50,13 @@ pub mod fmt {
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 37905b00..ebff59c1 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -93,7 +93,7 @@ pub struct DeviceProperties {
}
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 ::std::error::Error for Error {
}
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 6546921d..1ab012d4 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};