1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 12:23:46 +03:00

cargo fmt with current stable rustfmt

This commit is contained in:
Wez Furlong 2018-09-19 20:06:31 -07:00
parent 3090d5c6f4
commit 61fec42216
13 changed files with 44 additions and 73 deletions

View File

@ -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)?;

View File

@ -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)?;

View File

@ -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);

View File

@ -130,8 +130,7 @@ impl Inner {
io::ErrorKind::Other,
format!("fd {} is not present in IOMgr fd_map", fd),
)
})?
.clone();
})?.clone();
poll.deregister(&*evented)?;

View File

@ -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)

View File

@ -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(|_| ())
}));
}

View File

@ -1239,8 +1239,7 @@ impl TerminalState {
ypos + cell_pixel_height as f32,
),
image_data.clone(),
))))
.clone(),
)))).clone(),
),
);
xpos += x_delta;

View File

@ -223,8 +223,7 @@ impl Capabilities {
db.get::<cap::BackColorErase>()
.unwrap_or(cap::BackColorErase(false))
.0
})
.unwrap_or(false)
}).unwrap_or(false)
}
}
});

View File

@ -224,8 +224,7 @@ impl Rule {
link,
range: m.range(),
}
})
.collect()
}).collect()
}
}

View File

@ -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);

View File

@ -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()
}

View File

@ -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()
),]]
);
}

View File

@ -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 {