1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 02:25:28 +03:00

update rustfmt

This commit is contained in:
Wez Furlong 2018-07-11 08:30:49 -07:00
parent 6efce9943c
commit 039eadc05f
10 changed files with 35 additions and 43 deletions

View File

@ -12,4 +12,3 @@ tab_spaces = 4
use_field_init_shorthand = true
use_try_shorthand = true
wrap_comments = true
write_mode = "overwrite"

View File

@ -176,8 +176,7 @@ pub struct StyleRule {
impl Config {
pub fn load() -> Result<Self, Error> {
let dirs = UserDirs::new()
.ok_or_else(|| err_msg("can't find home dir"))?;
let dirs = UserDirs::new().ok_or_else(|| err_msg("can't find home dir"))?;
let home = dirs.home_dir();
// Note that the directories crate has methods for locating project

View File

@ -5,8 +5,10 @@ use super::hbwrap as harfbuzz;
use config::{Config, TextStyle};
use failure::{self, Error};
use font::{fcwrap, ftwrap};
use font::{shape_with_harfbuzz, FallbackIdx, Font, FontMetrics, FontSystem, GlyphInfo, NamedFont,
RasterizedGlyph};
use font::{
shape_with_harfbuzz, FallbackIdx, Font, FontMetrics, FontSystem, GlyphInfo, NamedFont,
RasterizedGlyph,
};
use std::cell::RefCell;
use std::mem;
use std::slice;
@ -285,7 +287,8 @@ impl NamedFontImpl {
fn load_next_fallback(&mut self) -> Result<(), Error> {
let idx = self.fonts.len();
let pat = self.font_list
let pat = self
.font_list
.iter()
.nth(idx)
.ok_or_else(|| failure::err_msg("no more fallbacks"))?;

View File

@ -186,7 +186,8 @@ impl GuiEventLoop {
};
if let Err(err) = result {
if err.downcast_ref::<gliumwindows::SessionTerminated>()
if err
.downcast_ref::<gliumwindows::SessionTerminated>()
.is_some()
{
self.schedule_window_close(window_id)?;
@ -247,7 +248,8 @@ impl GuiEventLoop {
loop {
match self.sigchld_rx.try_recv() {
Ok(_) => {
let window_ids: Vec<WindowId> = self.windows
let window_ids: Vec<WindowId> = self
.windows
.borrow_mut()
.by_id
.iter_mut()

View File

@ -435,7 +435,8 @@ impl GuiEventLoop {
loop {
match self.sigchld_rx.try_recv() {
Ok(_) => {
let window_ids: Vec<WindowId> = self.windows
let window_ids: Vec<WindowId> = self
.windows
.borrow_mut()
.by_id
.iter_mut()

View File

@ -482,7 +482,8 @@ impl Renderer {
(glyph.width as u32, glyph.height as u32),
);
let tex = self.atlas
let tex = self
.atlas
.borrow_mut()
.allocate(raw_im.width, raw_im.height, raw_im)?;
@ -870,7 +871,8 @@ impl Renderer {
target: &mut glium::Frame,
term: &mut term::Terminal,
) -> Result<(), Error> {
let background_color = self.palette
let background_color = self
.palette
.resolve(&term::color::ColorAttribute::Background);
let (r, g, b, a) = background_color.to_linear_tuple_rgba();
target.clear_color(r, g, b, a);

View File

@ -122,7 +122,8 @@ impl IOMgr {
impl Inner {
fn dereg(&mut self, poll: &Poll, fd: RawFd) -> Result<(), io::Error> {
let evented = self.fd_map
let evented = self
.fd_map
.get(&fd)
.ok_or_else(|| {
io::Error::new(

View File

@ -16,8 +16,9 @@ use std::result;
use x11;
use xcb;
use xcb_util;
use xcb_util::ffi::keysyms::{xcb_key_press_lookup_keysym, xcb_key_symbols_alloc,
xcb_key_symbols_free, xcb_key_symbols_t};
use xcb_util::ffi::keysyms::{
xcb_key_press_lookup_keysym, xcb_key_symbols_alloc, xcb_key_symbols_free, xcb_key_symbols_t,
};
use failure::{self, Error};
pub type Result<T> = result::Result<T, Error>;
@ -246,7 +247,8 @@ impl Window {
screen.root_visual(),
&[(
xcb::CW_EVENT_MASK,
xcb::EVENT_MASK_EXPOSURE | xcb::EVENT_MASK_KEY_PRESS
xcb::EVENT_MASK_EXPOSURE
| xcb::EVENT_MASK_KEY_PRESS
| xcb::EVENT_MASK_BUTTON_PRESS
| xcb::EVENT_MASK_BUTTON_RELEASE
| xcb::EVENT_MASK_POINTER_MOTION
@ -271,11 +273,13 @@ impl Window {
&[conn.atom_delete],
);
let surface = conn.egl_display
let surface = conn
.egl_display
.create_window_surface(conn.egl_config, window.window_id as *mut _)
.map_err(egli_err)?;
let egl_context = conn.egl_display
let egl_context = conn
.egl_display
.create_context_with_client_version(
conn.egl_config,
egli::ContextClientVersion::OpenGlEs2,

View File

@ -394,7 +394,8 @@ impl TerminalWindow {
const BUFSIZE: usize = 8192;
let mut buf = [0; BUFSIZE];
let tab = self.tabs
let tab = self
.tabs
.get_for_fd(fd)
.ok_or_else(|| format_err!("no tab for fd {}", fd))?;
@ -421,7 +422,8 @@ impl TerminalWindow {
fn decode_key(&self, event: &xcb::KeyPressEvent) -> (KeyCode, KeyModifiers) {
let mods = xkeysyms::modifiers(event);
let sym = self.conn
let sym = self
.conn
.lookup_keysym(event, mods.contains(KeyModifiers::SHIFT));
(xkeysyms::xcb_keysym_to_keycode(sym), mods)
}

View File

@ -268,30 +268,9 @@ impl Default for ColorPalette {
// 24 grey scales
static GREYS: [u8; 24] = [
0x08,
0x12,
0x1c,
0x26,
0x30,
0x3a,
0x44,
0x4e,
0x58,
0x62,
0x6c,
0x76,
0x80,
0x8a,
0x94,
0x9e,
0xa8,
0xb2, /* Grey70 */
0xbc,
0xc6,
0xd0,
0xda,
0xe4,
0xee,
0x08, 0x12, 0x1c, 0x26, 0x30, 0x3a, 0x44, 0x4e, 0x58, 0x62, 0x6c, 0x76, 0x80, 0x8a,
0x94, 0x9e, 0xa8, 0xb2, /* Grey70 */
0xbc, 0xc6, 0xd0, 0xda, 0xe4, 0xee,
];
for idx in 0..24 {