diff options
author | golem131 <golem131@users.noreply.github.com> | 2018-01-26 23:20:42 +0300 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2018-01-26 20:20:42 +0000 |
commit | b82622e9948d1c90fc628739c7f328816214fb33 (patch) | |
tree | 4b0d306460c302258953f758c19cba60bad2ee06 /src | |
parent | 59b561b440060e7b0d13160fb69519d127e6c687 (diff) | |
download | alacritty-b82622e9948d1c90fc628739c7f328816214fb33.tar.gz alacritty-b82622e9948d1c90fc628739c7f328816214fb33.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/cli.rs | 14 | ||||
-rw-r--r-- | src/event_loop.rs | 4 | ||||
-rw-r--r-- | src/logging.rs | 17 | ||||
-rw-r--r-- | src/renderer/mod.rs | 2 |
4 files changed, 18 insertions, 19 deletions
@@ -27,7 +27,7 @@ pub struct Options { pub ref_test: bool, pub dimensions: Option<Dimensions>, pub title: String, - pub log_level: log::LogLevelFilter, + pub log_level: log::LevelFilter, pub command: Option<Shell<'static>>, pub working_dir: Option<PathBuf>, pub config: Option<PathBuf>, @@ -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<Io> EventLoop<Io> ) -> 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<Io> EventLoop<Io> ) -> thread::JoinHandle<(EventLoop<Io>, 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<T> { - level: log::LogLevelFilter, + level: log::LevelFilter, output: sync::Mutex<T> } impl<T: Send + io::Write> Logger<T> { // 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<io::LineWriter<T>> { + pub fn new(output: T, level: log::LevelFilter) -> Logger<io::LineWriter<T>> { Logger { level: level, output: sync::Mutex::new(io::LineWriter::new(output)) @@ -39,28 +39,27 @@ impl<T: Send + io::Write> Logger<T> { } impl<T: Send + io::Write> log::Log for Logger<T> { - 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 { |