From b82622e9948d1c90fc628739c7f328816214fb33 Mon Sep 17 00:00:00 2001 From: golem131 Date: Fri, 26 Jan 2018 23:20:42 +0300 Subject: Update dependencies Updated the version of some dependencies. This also changes to a new clippy version so clippy can work with the latest nightly compiler again. Some issues created by new lints have been fixed. --- src/cli.rs | 14 +++++++------- src/event_loop.rs | 4 ++-- src/logging.rs | 17 ++++++++--------- src/renderer/mod.rs | 2 +- 4 files changed, 18 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/cli.rs b/src/cli.rs index 30ad0da4..532c46cd 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -27,7 +27,7 @@ pub struct Options { pub ref_test: bool, pub dimensions: Option, pub title: String, - pub log_level: log::LogLevelFilter, + pub log_level: log::LevelFilter, pub command: Option>, pub working_dir: Option, pub config: Option, @@ -41,7 +41,7 @@ impl Default for Options { ref_test: false, dimensions: None, title: DEFAULT_TITLE.to_owned(), - log_level: log::LogLevelFilter::Warn, + log_level: log::LevelFilter::Warn, command: None, working_dir: None, config: None, @@ -138,15 +138,15 @@ impl Options { match matches.occurrences_of("q") { 0 => {}, - 1 => options.log_level = log::LogLevelFilter::Error, - 2 | _ => options.log_level = log::LogLevelFilter::Off + 1 => options.log_level = log::LevelFilter::Error, + 2 | _ => options.log_level = log::LevelFilter::Off } match matches.occurrences_of("v") { 0 => {}, - 1 => options.log_level = log::LogLevelFilter::Info, - 2 => options.log_level = log::LogLevelFilter::Debug, - 3 | _ => options.log_level = log::LogLevelFilter::Trace + 1 => options.log_level = log::LevelFilter::Info, + 2 => options.log_level = log::LevelFilter::Debug, + 3 | _ => options.log_level = log::LevelFilter::Trace } if let Some(dir) = matches.value_of("working-directory") { diff --git a/src/event_loop.rs b/src/event_loop.rs index 9f02118f..30732e2a 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -251,7 +251,7 @@ impl EventLoop ) -> io::Result<()> where W: Write { - const MAX_READ: usize = 65_536; + const MAX_READ: usize = 0x1_0000; let mut processed = 0; let mut terminal = None; @@ -350,7 +350,7 @@ impl EventLoop ) -> thread::JoinHandle<(EventLoop, State)> { thread::spawn_named("pty reader", move || { let mut state = state.unwrap_or_else(Default::default); - let mut buf = [0u8; 4096]; + let mut buf = [0u8; 0x1000]; let fd = self.pty.as_raw_fd(); let fd = EventedFd(&fd); diff --git a/src/logging.rs b/src/logging.rs index 1fe769fd..ff2a7735 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -23,14 +23,14 @@ use std::io; use cli; pub struct Logger { - level: log::LogLevelFilter, + level: log::LevelFilter, output: sync::Mutex } impl Logger { // False positive, see: https://github.com/rust-lang-nursery/rust-clippy/issues/734 #[cfg_attr(feature = "clippy", allow(new_ret_no_self))] - pub fn new(output: T, level: log::LogLevelFilter) -> Logger> { + pub fn new(output: T, level: log::LevelFilter) -> Logger> { Logger { level: level, output: sync::Mutex::new(io::LineWriter::new(output)) @@ -39,28 +39,27 @@ impl Logger { } impl log::Log for Logger { - fn enabled(&self, metadata: &log::LogMetadata) -> bool { + fn enabled(&self, metadata: &log::Metadata) -> bool { metadata.level() <= self.level } - fn log(&self, record: &log::LogRecord) { + fn log(&self, record: &log::Record) { if self.enabled(record.metadata()) && record.target().starts_with("alacritty") { if let Ok(ref mut writer) = self.output.lock() { writer.write_all(format!("{}\n", record.args()).as_ref()).expect("Error while logging!"); } } } + + fn flush(&self) {} } pub fn initialize(options: &cli::Options) -> Result<(), log::SetLoggerError> { // Use env_logger if RUST_LOG environment variable is defined. Otherwise, // use the alacritty-only logger. if ::std::env::var("RUST_LOG").is_ok() { - ::env_logger::init() + ::env_logger::try_init() } else { - log::set_logger(|max_log_level| { - max_log_level.set(options.log_level); - Box::new(Logger::new(io::stdout(), options.log_level)) - }) + log::set_boxed_logger(Box::new(Logger::new(io::stdout(), options.log_level))) } } diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index c226a88d..c0e4a9f3 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -471,7 +471,7 @@ impl Batch { } /// Maximum items to be drawn in a batch. -const BATCH_MAX: usize = 65_536; +const BATCH_MAX: usize = 0x1_0000; const ATLAS_SIZE: i32 = 1024; impl QuadRenderer { -- cgit v1.2.3-54-g00ecf