From 61fec422167665f47608b6d2c5bc01251d379b33 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 19 Sep 2018 20:06:31 -0700 Subject: [PATCH] cargo fmt with current stable rustfmt --- src/guiloop/glutinloop.rs | 6 ++---- src/guiloop/x11.rs | 6 ++---- src/main.rs | 6 ++---- src/remotemio.rs | 3 +-- src/xwindows/mod.rs | 6 ++---- src/xwindows/xwin.rs | 3 +-- term/src/terminalstate.rs | 3 +-- termwiz/src/caps/mod.rs | 3 +-- termwiz/src/hyperlink.rs | 3 +-- termwiz/src/input.rs | 3 ++- termwiz/src/render/terminfo.rs | 15 +++++++++------ termwiz/src/surface/mod.rs | 30 ++++++++++-------------------- termwiz/src/widgets/layout.rs | 30 ++++++++++-------------------- 13 files changed, 44 insertions(+), 73 deletions(-) diff --git a/src/guiloop/glutinloop.rs b/src/guiloop/glutinloop.rs index dfe126a2b..a1afcb484 100644 --- a/src/guiloop/glutinloop.rs +++ b/src/guiloop/glutinloop.rs @@ -172,8 +172,7 @@ impl GuiEventLoop { .get(&fd) .ok_or_else(|| { format_err!("fd {} has no associated window in windows_by_fd map", fd) - }) - .map(|w| *w)?; + }).map(|w| *w)?; let window = windows.by_id.get_mut(&window_id).ok_or_else(|| { format_err!( @@ -256,8 +255,7 @@ impl GuiEventLoop { .filter_map(|(window_id, window)| match window.test_for_child_exit() { Ok(_) => None, Err(_) => Some(*window_id), - }) - .collect(); + }).collect(); for window_id in window_ids { self.schedule_window_close(window_id)?; diff --git a/src/guiloop/x11.rs b/src/guiloop/x11.rs index 262ca1ffa..5581f1764 100644 --- a/src/guiloop/x11.rs +++ b/src/guiloop/x11.rs @@ -264,8 +264,7 @@ impl GuiEventLoop { .get(&fd) .ok_or_else(|| { format_err!("fd {} has no associated window in windows_by_fd map", fd) - }) - .map(|w| Rc::clone(w))?; + }).map(|w| Rc::clone(w))?; let window = windows.by_id.get_mut(&entry.window_id).ok_or_else(|| { format_err!( @@ -443,8 +442,7 @@ impl GuiEventLoop { .filter_map(|(window_id, window)| match window.test_for_child_exit() { Ok(_) => None, Err(_) => Some(*window_id), - }) - .collect(); + }).collect(); for window_id in window_ids { self.schedule_window_close(window_id, None)?; diff --git a/src/main.rs b/src/main.rs index 25addd8db..e8364d6b6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -100,13 +100,11 @@ fn run() -> Result<(), Error> { .about( "Wez's Terminal Emulator\n\ http://github.com/wez/wezterm", - ) - .arg(Arg::with_name("PROG").multiple(true).help( + ).arg(Arg::with_name("PROG").multiple(true).help( "Instead of executing your shell, run PROG. \ For example: `wezterm -- bash -l` will spawn bash \ as if it were a login shell.", - )) - .get_matches(); + )).get_matches(); let config = Rc::new(config::Config::load()?); println!("Using configuration: {:#?}", config); diff --git a/src/remotemio.rs b/src/remotemio.rs index db76413ae..3cd33572f 100644 --- a/src/remotemio.rs +++ b/src/remotemio.rs @@ -130,8 +130,7 @@ impl Inner { io::ErrorKind::Other, format!("fd {} is not present in IOMgr fd_map", fd), ) - })? - .clone(); + })?.clone(); poll.deregister(&*evented)?; diff --git a/src/xwindows/mod.rs b/src/xwindows/mod.rs index ac5d14890..82bbe8075 100644 --- a/src/xwindows/mod.rs +++ b/src/xwindows/mod.rs @@ -130,8 +130,7 @@ impl Connection { .with_depth_size(24) .with_surface_type( egli::SurfaceType::WINDOW | egli::SurfaceType::PBUFFER | egli::SurfaceType::PIXMAP, - ) - .with_renderable_type(egli::RenderableType::OPENGL_ES2) + ).with_renderable_type(egli::RenderableType::OPENGL_ES2) .with_conformant(egli::RenderableType::OPENGL_ES2) .choose_configs() .map_err(|e| format_err!("failed to get EGL config: {:?}", e))?; @@ -283,8 +282,7 @@ impl Window { .create_context_with_client_version( conn.egl_config, egli::ContextClientVersion::OpenGlEs2, - ) - .map_err(egli_err)?; + ).map_err(egli_err)?; conn.egl_display .make_current(&surface, &surface, &egl_context) diff --git a/src/xwindows/xwin.rs b/src/xwindows/xwin.rs index b54dc0dde..efabc65f6 100644 --- a/src/xwindows/xwin.rs +++ b/src/xwindows/xwin.rs @@ -151,8 +151,7 @@ impl<'a> term::TerminalHost for TabHost<'a> { .with_window(window_id, |win| { win.update_title(); Ok(()) - }) - .map(futures::Async::Ready) + }).map(futures::Async::Ready) .map_err(|_| ()) })); } diff --git a/term/src/terminalstate.rs b/term/src/terminalstate.rs index b5bf921c2..96d7a0d3f 100644 --- a/term/src/terminalstate.rs +++ b/term/src/terminalstate.rs @@ -1239,8 +1239,7 @@ impl TerminalState { ypos + cell_pixel_height as f32, ), image_data.clone(), - )))) - .clone(), + )))).clone(), ), ); xpos += x_delta; diff --git a/termwiz/src/caps/mod.rs b/termwiz/src/caps/mod.rs index bdd01992f..ae07f112f 100644 --- a/termwiz/src/caps/mod.rs +++ b/termwiz/src/caps/mod.rs @@ -223,8 +223,7 @@ impl Capabilities { db.get::() .unwrap_or(cap::BackColorErase(false)) .0 - }) - .unwrap_or(false) + }).unwrap_or(false) } } }); diff --git a/termwiz/src/hyperlink.rs b/termwiz/src/hyperlink.rs index 6c4fb8de2..cd366e391 100644 --- a/termwiz/src/hyperlink.rs +++ b/termwiz/src/hyperlink.rs @@ -224,8 +224,7 @@ impl Rule { link, range: m.range(), } - }) - .collect() + }).collect() } } diff --git a/termwiz/src/input.rs b/termwiz/src/input.rs index 365723263..3fc87460d 100644 --- a/termwiz/src/input.rs +++ b/termwiz/src/input.rs @@ -764,7 +764,8 @@ impl InputParser { }), ), _, - ) if self.state == InputState::Normal && self.buf.len() > len => + ) + if self.state == InputState::Normal && self.buf.len() > len => { self.state = InputState::EscapeMaybeAlt; self.buf.advance(len); diff --git a/termwiz/src/render/terminfo.rs b/termwiz/src/render/terminfo.rs index 5cf512e21..6178b9298 100644 --- a/termwiz/src/render/terminfo.rs +++ b/termwiz/src/render/terminfo.rs @@ -448,28 +448,32 @@ impl TerminfoRenderer { Change::CursorPosition { x: Position::NoChange, y: Position::Relative(n), - } if *n > 0 => + } + if *n > 0 => { self.cursor_down(*n as u32, out)?; } Change::CursorPosition { x: Position::NoChange, y: Position::Relative(n), - } if *n < 0 => + } + if *n < 0 => { self.cursor_up(*n as u32, out)?; } Change::CursorPosition { x: Position::Relative(n), y: Position::NoChange, - } if *n < 0 => + } + if *n < 0 => { self.cursor_left(*n as u32, out)?; } Change::CursorPosition { x: Position::Relative(n), y: Position::NoChange, - } if *n > 0 => + } + if *n > 0 => { self.cursor_right(*n as u32, out)?; } @@ -617,8 +621,7 @@ mod test { ProbeHintsBuilder::default() .terminfo_db(Some( terminfo::Database::from_buffer(data.as_ref()).unwrap(), - )) - .build() + )).build() .unwrap(), ).unwrap() } diff --git a/termwiz/src/surface/mod.rs b/termwiz/src/surface/mod.rs index d1913a5eb..a89625364 100644 --- a/termwiz/src/surface/mod.rs +++ b/termwiz/src/surface/mod.rs @@ -216,8 +216,7 @@ impl Surface { image.top_left.y + ypos + ysize, ), image.image.clone(), - )))) - .clone(), + )))).clone(), ), ); @@ -1435,8 +1434,7 @@ mod test { TextureCoordinate::new_f32(0.0, 0.0), TextureCoordinate::new_f32(0.25, 0.5), data.clone() - )))) - .clone() + )))).clone() ), Cell::new( ' ', @@ -1445,8 +1443,7 @@ mod test { TextureCoordinate::new_f32(0.25, 0.0), TextureCoordinate::new_f32(0.5, 0.5), data.clone() - )))) - .clone() + )))).clone() ), Cell::new( ' ', @@ -1455,8 +1452,7 @@ mod test { TextureCoordinate::new_f32(0.5, 0.0), TextureCoordinate::new_f32(0.75, 0.5), data.clone() - )))) - .clone() + )))).clone() ), Cell::new( ' ', @@ -1465,8 +1461,7 @@ mod test { TextureCoordinate::new_f32(0.75, 0.0), TextureCoordinate::new_f32(1.0, 0.5), data.clone() - )))) - .clone() + )))).clone() ), ], [ @@ -1477,8 +1472,7 @@ mod test { TextureCoordinate::new_f32(0.0, 0.5), TextureCoordinate::new_f32(0.25, 1.0), data.clone() - )))) - .clone() + )))).clone() ), Cell::new( ' ', @@ -1487,8 +1481,7 @@ mod test { TextureCoordinate::new_f32(0.25, 0.5), TextureCoordinate::new_f32(0.5, 1.0), data.clone() - )))) - .clone() + )))).clone() ), Cell::new( ' ', @@ -1497,8 +1490,7 @@ mod test { TextureCoordinate::new_f32(0.5, 0.5), TextureCoordinate::new_f32(0.75, 1.0), data.clone() - )))) - .clone() + )))).clone() ), Cell::new( ' ', @@ -1507,8 +1499,7 @@ mod test { TextureCoordinate::new_f32(0.75, 0.5), TextureCoordinate::new_f32(1.0, 1.0), data.clone() - )))) - .clone() + )))).clone() ), ], ] @@ -1533,8 +1524,7 @@ mod test { TextureCoordinate::new_f32(0.25, 0.3), TextureCoordinate::new_f32(0.75, 0.8), data.clone() - )))) - .clone() + )))).clone() ),]] ); } diff --git a/termwiz/src/widgets/layout.rs b/termwiz/src/widgets/layout.rs index 437fdd114..3935da267 100644 --- a/termwiz/src/widgets/layout.rs +++ b/termwiz/src/widgets/layout.rs @@ -326,8 +326,7 @@ impl LayoutState { self.solver .add_constraint( state.left + state.width | LE(REQUIRED) | parent_left.clone() + parent_width, - ) - .map_err(adderr)?; + ).map_err(adderr)?; self.solver .add_constraint(state.left | GE(REQUIRED) | parent_left.clone()) .map_err(adderr)?; @@ -335,8 +334,7 @@ impl LayoutState { self.solver .add_constraint( state.top + state.height | LE(REQUIRED) | parent_top.clone() + parent_height, - ) - .map_err(adderr)?; + ).map_err(adderr)?; self.solver .add_constraint(state.top | GE(REQUIRED) | parent_top.clone()) .map_err(adderr)?; @@ -385,8 +383,7 @@ impl LayoutState { self.solver .add_constraint( state.width | EQ(STRONG) | f64::from(pct) * parent_width / 100.0, - ) - .map_err(adderr)?; + ).map_err(adderr)?; } } self.solver @@ -394,8 +391,7 @@ impl LayoutState { state.width | GE(STRONG) | f64::from(state.constraints.width.minimum.unwrap_or(1).max(1)), - ) - .map_err(adderr)?; + ).map_err(adderr)?; if let Some(max_width) = state.constraints.width.maximum { self.solver .add_constraint(state.width | LE(STRONG) | f64::from(max_width)) @@ -412,8 +408,7 @@ impl LayoutState { self.solver .add_constraint( state.height | EQ(STRONG) | f64::from(pct) * parent_height / 100.0, - ) - .map_err(adderr)?; + ).map_err(adderr)?; } } self.solver @@ -421,8 +416,7 @@ impl LayoutState { state.height | GE(STRONG) | f64::from(state.constraints.height.minimum.unwrap_or(1).max(1)), - ) - .map_err(adderr)?; + ).map_err(adderr)?; if let Some(max_height) = state.constraints.height.maximum { self.solver .add_constraint(state.height | LE(STRONG) | f64::from(max_height)) @@ -456,16 +450,14 @@ impl LayoutState { child_state.left + child_state.width | EQ(STRONG) | state.left + state.width, - ) - .map_err(adderr)?, + ).map_err(adderr)?, HorizontalAlignment::Center => self .solver .add_constraint( child_state.left | EQ(STRONG) | state.left + (state.width - child_state.width) / 2.0, - ) - .map_err(adderr)?, + ).map_err(adderr)?, } match child_state.constraints.valign { @@ -479,16 +471,14 @@ impl LayoutState { child_state.top + child_state.height | EQ(STRONG) | state.top + state.height, - ) - .map_err(adderr)?, + ).map_err(adderr)?, VerticalAlignment::Middle => self .solver .add_constraint( child_state.top | EQ(STRONG) | state.top + (state.height - child_state.height) / 2.0, - ) - .map_err(adderr)?, + ).map_err(adderr)?, } match state.constraints.child_orientation {