Fix clippy lints

This commit is contained in:
Alexandre Bury 2020-05-26 11:31:40 -07:00
parent d9161f12fc
commit a9ae211928
6 changed files with 20 additions and 33 deletions

View File

@ -69,10 +69,8 @@ impl EventTrigger {
T: Any + std::fmt::Debug,
{
let tag = Box::new(tag);
EventTrigger {
trigger: Box::new(f),
tag: tag,
}
let trigger = Box::new(f);
EventTrigger { trigger, tag }
}
/// Check if this trigger has the given tag.

View File

@ -3,13 +3,9 @@
//! Requires the `blt-backend` feature.
#![cfg(feature = "bear-lib-terminal")]
use bear_lib_terminal;
use self::bear_lib_terminal::geometry::Size;
use self::bear_lib_terminal::terminal::{
self, state, Event as BltEvent, KeyCode,
};
use self::bear_lib_terminal::Color as BltColor;
use bear_lib_terminal::geometry::Size;
use bear_lib_terminal::terminal::{self, state, Event as BltEvent, KeyCode};
use bear_lib_terminal::Color as BltColor;
use crate::backend;
use crate::event::{Event, Key, MouseButton, MouseEvent};

View File

@ -1,6 +1,6 @@
//! Ncurses-specific backend.
use log::{debug, warn};
use ncurses;
use ncurses::mmask_t;
use std::cell::{Cell, RefCell};
use std::ffi::CString;
@ -8,8 +8,6 @@ use std::fs::File;
use std::io;
use std::io::Write;
use libc;
use crate::backend;
use crate::event::{Event, Key, MouseButton, MouseEvent};
use crate::theme::{Color, ColorPair, Effect};
@ -17,7 +15,6 @@ use crate::utf8;
use crate::Vec2;
use self::super::split_i32;
use self::ncurses::mmask_t;
// Use AHash instead of the slower SipHash
type HashMap<K, V> = std::collections::HashMap<K, V, ahash::RandomState>;

View File

@ -1,6 +1,5 @@
//! Pancuses-specific backend.
use log::{debug, warn};
use pancurses;
use std::cell::{Cell, RefCell};
use std::io::{stdout, Write};
@ -10,8 +9,8 @@ use crate::event::{Event, Key, MouseButton, MouseEvent};
use crate::theme::{Color, ColorPair, Effect};
use crate::Vec2;
use self::pancurses::mmask_t;
use super::split_i32;
use pancurses::mmask_t;
// Use AHash instead of the slower SipHash
type HashMap<K, V> = std::collections::HashMap<K, V, ahash::RandomState>;

View File

@ -95,13 +95,13 @@ pub struct ObservedScreen {
impl Display for ObservedScreen {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "captured piece:\n")?;
writeln!(f, "captured piece:")?;
write!(f, "x")?;
for x in 0..self.size().x {
write!(f, "{}", x % 10)?;
}
write!(f, "x\n")?;
writeln!(f, "x")?;
for y in 0..self.size().y {
write!(f, "{}", y % 10)?;
@ -127,15 +127,14 @@ impl Display for ObservedScreen {
write!(f, ".")?;
}
}
write!(f, "|")?;
write!(f, "\n")?;
writeln!(f, "|")?;
}
write!(f, "x")?;
for _x in 0..self.size().x {
write!(f, "-")?;
}
write!(f, "x\n")?;
writeln!(f, "x")?;
Ok(())
}
}

View File

@ -3,18 +3,16 @@
//! Requires the `termion-backend` feature.
#![cfg(feature = "termion")]
use termion;
use self::termion::color as tcolor;
use self::termion::event::Event as TEvent;
use self::termion::event::Key as TKey;
use self::termion::event::MouseButton as TMouseButton;
use self::termion::event::MouseEvent as TMouseEvent;
use self::termion::input::{MouseTerminal, TermRead};
use self::termion::raw::{IntoRawMode, RawTerminal};
use self::termion::screen::AlternateScreen;
use self::termion::style as tstyle;
use crossbeam_channel::{self, select, Receiver};
use termion::color as tcolor;
use termion::event::Event as TEvent;
use termion::event::Key as TKey;
use termion::event::MouseButton as TMouseButton;
use termion::event::MouseEvent as TMouseEvent;
use termion::input::{MouseTerminal, TermRead};
use termion::raw::{IntoRawMode, RawTerminal};
use termion::screen::AlternateScreen;
use termion::style as tstyle;
use crate::backend;
use crate::backends;