Update rustfmt configuration
In this change I went through all current rustfmt configuration options and expanded our existing configuration with overrides whenever deemed appropriate. The `normalize_doc_attributes` option is still unstable, but seems to work without any issues. Even when passing macros like `include_str!` that is recognized properly and not normalized. So while this wasn't an issue anywhere in the code, it should make sure it never will be. When it comes to imports there are two new major additions. The `imports_granularity` and `group_imports` options. Both mostly just incorporate unwritten rules that have existed in Alacritty for a long time. Unfortunately since `alacritty_terminal` imports in `alacritty` are supposed to be separate blocks, the `group_imports` option cannot be used.
This commit is contained in:
parent
ec4dc32688
commit
f90dd12efd
|
@ -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)]
|
||||
|
|
|
@ -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",
|
||||
))
|
||||
));
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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::{
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue