From 039eadc05f6d38fe4c4b8fa128cf862f38e524a5 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 11 Jul 2018 08:30:49 -0700 Subject: [PATCH] update rustfmt --- .rustfmt.toml | 1 - src/config.rs | 3 +-- src/font/fontconfigandfreetype.rs | 9 ++++++--- src/guiloop/glutinloop.rs | 6 ++++-- src/guiloop/x11.rs | 3 ++- src/opengl/render.rs | 6 ++++-- src/remotemio.rs | 3 ++- src/xwindows/mod.rs | 14 +++++++++----- src/xwindows/xwin.rs | 6 ++++-- term/src/color.rs | 27 +++------------------------ 10 files changed, 35 insertions(+), 43 deletions(-) diff --git a/.rustfmt.toml b/.rustfmt.toml index 0ed00355c..d7731ebf6 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -12,4 +12,3 @@ tab_spaces = 4 use_field_init_shorthand = true use_try_shorthand = true wrap_comments = true -write_mode = "overwrite" diff --git a/src/config.rs b/src/config.rs index a716b161d..957156b6e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -176,8 +176,7 @@ pub struct StyleRule { impl Config { pub fn load() -> Result { - 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 diff --git a/src/font/fontconfigandfreetype.rs b/src/font/fontconfigandfreetype.rs index 674acb03f..e21dce328 100644 --- a/src/font/fontconfigandfreetype.rs +++ b/src/font/fontconfigandfreetype.rs @@ -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"))?; diff --git a/src/guiloop/glutinloop.rs b/src/guiloop/glutinloop.rs index 2cb6ef1a3..dfe126a2b 100644 --- a/src/guiloop/glutinloop.rs +++ b/src/guiloop/glutinloop.rs @@ -186,7 +186,8 @@ impl GuiEventLoop { }; if let Err(err) = result { - if err.downcast_ref::() + if err + .downcast_ref::() .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 = self.windows + let window_ids: Vec = self + .windows .borrow_mut() .by_id .iter_mut() diff --git a/src/guiloop/x11.rs b/src/guiloop/x11.rs index cfa671ec3..262ca1ffa 100644 --- a/src/guiloop/x11.rs +++ b/src/guiloop/x11.rs @@ -435,7 +435,8 @@ impl GuiEventLoop { loop { match self.sigchld_rx.try_recv() { Ok(_) => { - let window_ids: Vec = self.windows + let window_ids: Vec = self + .windows .borrow_mut() .by_id .iter_mut() diff --git a/src/opengl/render.rs b/src/opengl/render.rs index ec90dd7c5..c53a85005 100644 --- a/src/opengl/render.rs +++ b/src/opengl/render.rs @@ -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); diff --git a/src/remotemio.rs b/src/remotemio.rs index 991d16af9..db76413ae 100644 --- a/src/remotemio.rs +++ b/src/remotemio.rs @@ -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( diff --git a/src/xwindows/mod.rs b/src/xwindows/mod.rs index a12155d3d..ac5d14890 100644 --- a/src/xwindows/mod.rs +++ b/src/xwindows/mod.rs @@ -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 = result::Result; @@ -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, diff --git a/src/xwindows/xwin.rs b/src/xwindows/xwin.rs index 9efbb2ffc..f40802cfb 100644 --- a/src/xwindows/xwin.rs +++ b/src/xwindows/xwin.rs @@ -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) } diff --git a/term/src/color.rs b/term/src/color.rs index 7cdcdc160..d74034f99 100644 --- a/term/src/color.rs +++ b/term/src/color.rs @@ -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 {