aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alacritty/src/cli.rs3
-rw-r--r--alacritty/src/config/bindings.rs5
-rw-r--r--alacritty/src/event.rs4
-rw-r--r--alacritty/src/logging.rs3
-rw-r--r--alacritty/src/macos/locale.rs4
-rw-r--r--alacritty/src/macos/proc.rs3
-rw-r--r--alacritty/src/main.rs3
-rw-r--r--alacritty/src/panic.rs8
-rw-r--r--alacritty/src/renderer/mod.rs3
-rw-r--r--alacritty/src/renderer/rects.rs3
-rw-r--r--alacritty_terminal/src/event_loop.rs4
-rw-r--r--alacritty_terminal/src/grid/row.rs6
-rw-r--r--alacritty_terminal/src/tty/unix.rs12
-rw-r--r--alacritty_terminal/src/tty/windows/conpty.rs4
-rw-r--r--rustfmt.toml2
15 files changed, 26 insertions, 41 deletions
diff --git a/alacritty/src/cli.rs b/alacritty/src/cli.rs
index a1480807..b1e12007 100644
--- a/alacritty/src/cli.rs
+++ b/alacritty/src/cli.rs
@@ -7,9 +7,8 @@ use structopt::StructOpt;
use alacritty_terminal::config::Program;
-use crate::config::serde_utils;
use crate::config::window::{Class, DEFAULT_NAME};
-use crate::config::Config;
+use crate::config::{serde_utils, Config};
/// Options specified on the command line.
#[derive(StructOpt, Debug)]
diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs
index a4271430..8289fc20 100644
--- a/alacritty/src/config/bindings.rs
+++ b/alacritty/src/config/bindings.rs
@@ -5,8 +5,7 @@ use std::fmt::{self, Debug, Display};
use bitflags::bitflags;
use glutin::event::VirtualKeyCode::*;
use glutin::event::{ModifiersState, MouseButton, VirtualKeyCode};
-use serde::de::Error as SerdeError;
-use serde::de::{self, MapAccess, Unexpected, Visitor};
+use serde::de::{self, Error as SerdeError, MapAccess, Unexpected, Visitor};
use serde::{Deserialize, Deserializer};
use serde_yaml::Value as SerdeValue;
@@ -1139,7 +1138,7 @@ impl<'a> Deserialize<'a> for RawBinding {
_ => {
return Err(V::Error::custom(
"must specify exactly one of chars, action or command",
- ))
+ ));
},
};
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index 37dc2cd1..8e8fac08 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -3,19 +3,17 @@
use std::borrow::Cow;
use std::cmp::{max, min};
use std::collections::VecDeque;
-use std::env;
-use std::f32;
use std::fmt::Debug;
#[cfg(not(any(target_os = "macos", windows)))]
use std::fs;
use std::fs::File;
use std::io::Write;
-use std::mem;
use std::path::{Path, PathBuf};
#[cfg(not(any(target_os = "macos", windows)))]
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::time::{Duration, Instant};
+use std::{env, f32, mem};
use glutin::dpi::PhysicalSize;
use glutin::event::{ElementState, Event as GlutinEvent, ModifiersState, MouseButton, WindowEvent};
diff --git a/alacritty/src/logging.rs b/alacritty/src/logging.rs
index 7cef3887..8751c91e 100644
--- a/alacritty/src/logging.rs
+++ b/alacritty/src/logging.rs
@@ -4,13 +4,12 @@
//! startup. All logging messages are written to stdout, given that their
//! log-level is sufficient for the level configured in `cli::Options`.
-use std::env;
use std::fs::{File, OpenOptions};
use std::io::{self, LineWriter, Stdout, Write};
use std::path::PathBuf;
-use std::process;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
+use std::{env, process};
use glutin::event_loop::EventLoopProxy;
use log::{self, Level, LevelFilter};
diff --git a/alacritty/src/macos/locale.rs b/alacritty/src/macos/locale.rs
index 6c02c12c..2a47ace8 100644
--- a/alacritty/src/macos/locale.rs
+++ b/alacritty/src/macos/locale.rs
@@ -1,10 +1,8 @@
#![allow(clippy::let_unit_value)]
-use std::env;
use std::ffi::{CStr, CString};
use std::os::raw::c_char;
-use std::slice;
-use std::str;
+use std::{env, slice, str};
use libc::{setlocale, LC_ALL, LC_CTYPE};
use log::debug;
diff --git a/alacritty/src/macos/proc.rs b/alacritty/src/macos/proc.rs
index be7e4891..eaa879d9 100644
--- a/alacritty/src/macos/proc.rs
+++ b/alacritty/src/macos/proc.rs
@@ -150,8 +150,7 @@ mod sys {
mod tests {
use super::*;
- use std::env;
- use std::process;
+ use std::{env, process};
#[test]
fn cwd_matches_current_dir() {
diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs
index f6e3c1d0..488a67bc 100644
--- a/alacritty/src/main.rs
+++ b/alacritty/src/main.rs
@@ -52,8 +52,7 @@ mod gl {
}
use crate::cli::Options;
-use crate::config::monitor;
-use crate::config::Config;
+use crate::config::{monitor, Config};
use crate::display::Display;
use crate::event::{Event, EventProxy, Processor};
#[cfg(target_os = "macos")]
diff --git a/alacritty/src/panic.rs b/alacritty/src/panic.rs
index 9a76df72..2311d7b9 100644
--- a/alacritty/src/panic.rs
+++ b/alacritty/src/panic.rs
@@ -1,11 +1,13 @@
+use std::io::Write;
+use std::{io, panic, ptr};
+
+use winapi::um::winuser;
+
use alacritty_terminal::tty::windows::win32_string;
// Install a panic handler that renders the panic in a classical Windows error
// dialog box as well as writes the panic to STDERR.
pub fn attach_handler() {
- use std::{io, io::Write, panic, ptr};
- use winapi::um::winuser;
-
panic::set_hook(Box::new(|panic_info| {
let _ = writeln!(io::stderr(), "{}", panic_info);
let msg = format!("{}\n\nPress Ctrl-C to Copy", panic_info);
diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs
index 11ccfc63..23be70be 100644
--- a/alacritty/src/renderer/mod.rs
+++ b/alacritty/src/renderer/mod.rs
@@ -1,9 +1,8 @@
use std::collections::HashMap;
use std::fmt::{self, Display, Formatter};
use std::hash::BuildHasherDefault;
-use std::io;
use std::mem::size_of;
-use std::ptr;
+use std::{io, ptr};
use bitflags::bitflags;
use crossfont::{
diff --git a/alacritty/src/renderer/rects.rs b/alacritty/src/renderer/rects.rs
index 77c22011..fafa7a78 100644
--- a/alacritty/src/renderer/rects.rs
+++ b/alacritty/src/renderer/rects.rs
@@ -10,9 +10,8 @@ use alacritty_terminal::term::color::Rgb;
use alacritty_terminal::term::SizeInfo;
use crate::display::content::RenderableCell;
-use crate::gl;
use crate::gl::types::*;
-use crate::renderer;
+use crate::{gl, renderer};
#[derive(Debug, Copy, Clone)]
pub struct RenderRect {
diff --git a/alacritty_terminal/src/event_loop.rs b/alacritty_terminal/src/event_loop.rs
index b4c0a5e4..fbd882ad 100644
--- a/alacritty_terminal/src/event_loop.rs
+++ b/alacritty_terminal/src/event_loop.rs
@@ -15,12 +15,10 @@ use mio::unix::UnixReady;
use mio::{self, Events, PollOpt, Ready};
use mio_extras::channel::{self, Receiver, Sender};
-use crate::ansi;
use crate::event::{self, Event, EventListener};
use crate::sync::FairMutex;
use crate::term::{SizeInfo, Term};
-use crate::thread;
-use crate::tty;
+use crate::{ansi, thread, tty};
/// Max bytes to read from the PTY before forced terminal synchronization.
const READ_BUFFER_SIZE: usize = 0x10_0000;
diff --git a/alacritty_terminal/src/grid/row.rs b/alacritty_terminal/src/grid/row.rs
index c932e83f..f6bcb022 100644
--- a/alacritty_terminal/src/grid/row.rs
+++ b/alacritty_terminal/src/grid/row.rs
@@ -1,10 +1,8 @@
//! Defines the Row type which makes up lines in the grid.
use std::cmp::{max, min};
-use std::ops::{Index, IndexMut};
-use std::ops::{Range, RangeFrom, RangeFull, RangeTo, RangeToInclusive};
-use std::ptr;
-use std::slice;
+use std::ops::{Index, IndexMut, Range, RangeFrom, RangeFull, RangeTo, RangeToInclusive};
+use std::{ptr, slice};
use serde::{Deserialize, Serialize};
diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs
index a3c35f95..483333e7 100644
--- a/alacritty_terminal/src/tty/unix.rs
+++ b/alacritty_terminal/src/tty/unix.rs
@@ -5,15 +5,12 @@ use std::borrow::Cow;
use std::env;
use std::ffi::CStr;
use std::fs::File;
-use std::io;
use std::mem::MaybeUninit;
-use std::os::unix::{
- io::{AsRawFd, FromRawFd, RawFd},
- process::CommandExt,
-};
+use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
+use std::os::unix::process::CommandExt;
use std::process::{Child, Command, Stdio};
-use std::ptr;
use std::sync::atomic::{AtomicI32, AtomicUsize, Ordering};
+use std::{io, ptr};
use libc::{self, c_int, pid_t, winsize, TIOCSCTTY};
use log::error;
@@ -21,7 +18,8 @@ use mio::unix::EventedFd;
use nix::pty::openpty;
#[cfg(any(target_os = "linux", target_os = "macos"))]
use nix::sys::termios::{self, InputFlags, SetArg};
-use signal_hook::{self as sighook, iterator::Signals};
+use signal_hook as sighook;
+use signal_hook::iterator::Signals;
use crate::config::{Config, Program};
use crate::event::OnResize;
diff --git a/alacritty_terminal/src/tty/windows/conpty.rs b/alacritty_terminal/src/tty/windows/conpty.rs
index 919bd00f..002022ea 100644
--- a/alacritty_terminal/src/tty/windows/conpty.rs
+++ b/alacritty_terminal/src/tty/windows/conpty.rs
@@ -1,8 +1,6 @@
-use std::i16;
use std::io::Error;
-use std::mem;
use std::os::windows::io::IntoRawHandle;
-use std::ptr;
+use std::{i16, mem, ptr};
use mio_anonymous_pipes::{EventedAnonRead, EventedAnonWrite};
use winapi::shared::basetsd::{PSIZE_T, SIZE_T};
diff --git a/rustfmt.toml b/rustfmt.toml
index 9308ba98..f66efccf 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -2,7 +2,9 @@ format_code_in_doc_comments = true
match_block_trailing_comma = true
condense_wildcard_suffixes = true
use_field_init_shorthand = true
+normalize_doc_attributes = true
overflow_delimited_expr = true
+imports_granularity = "Module"
use_small_heuristics = "Max"
normalize_comments = true
reorder_impl_items = true