1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-14 03:16:09 +03:00

update rustfmt for 1.28

This commit is contained in:
Wez Furlong 2018-08-03 22:34:27 -07:00
parent 6fc620ce47
commit 1c6b51be46
5 changed files with 38 additions and 20 deletions

View File

@ -1,3 +1,2 @@
# Please keep these in alphabetical order.
tab_spaces = 4
wrap_comments = true

View File

@ -170,7 +170,8 @@ impl Capabilities {
_ => {
// COLORTERM isn't set, so look at the terminfo.
if let Some(ref db) = hints.terminfo_db.as_ref() {
let has_true_color = db.get::<cap::TrueColor>()
let has_true_color = db
.get::<cap::TrueColor>()
.unwrap_or(cap::TrueColor(false))
.0;
if has_true_color {

View File

@ -23,7 +23,8 @@ impl<Value: Debug> Node<Value> {
self.value = Some(value);
return;
}
match self.children
match self
.children
.binary_search_by(|node| node.label.cmp(&key[0]))
{
Ok(idx) => {
@ -54,7 +55,8 @@ impl<Value: Debug> Node<Value> {
};
}
match self.children
match self
.children
.binary_search_by(|node| node.label.cmp(&key[0]))
{
Ok(idx) => {

View File

@ -780,14 +780,16 @@ impl Surface {
// lines of text into simpler strings.
let mut attr: Option<CellAttributes> = None;
for ((row_num, line), other_line) in self.lines
for ((row_num, line), other_line) in self
.lines
.iter()
.enumerate()
.skip(y)
.take_while(|(row_num, _)| *row_num < y + height)
.zip(other.lines.iter().skip(other_y))
{
for ((col_num, cell), (_, other_cell)) in line.visible_cells()
for ((col_num, cell), (_, other_cell)) in line
.visible_cells()
.skip(x)
.take_while(|(col_num, _)| *col_num < x + width)
.zip(other_line.visible_cells().skip(other_x))

View File

@ -277,7 +277,8 @@ impl LayoutState {
parent_top: usize,
results: &mut Vec<LaidOutWidget>,
) -> Result<(), Error> {
let state = self.widget_states
let state = self
.widget_states
.get(&widget)
.ok_or_else(|| err_msg("widget has no solver state"))?;
let width = self.solver.get_value(state.width) as usize;
@ -310,7 +311,8 @@ impl LayoutState {
parent_left: Option<Variable>,
parent_top: Option<Variable>,
) -> Result<WidgetState, Error> {
let state = self.widget_states
let state = self
.widget_states
.get(&widget)
.ok_or_else(|| err_msg("widget has no solver state"))?
.clone();
@ -343,25 +345,31 @@ impl LayoutState {
// We handle alignment on the root widget specially here;
// for non-root widgets, we handle it when assessing children
match state.constraints.halign {
HorizontalAlignment::Left => self.solver
HorizontalAlignment::Left => self
.solver
.add_constraint(state.left | EQ(STRONG) | 0.0)
.map_err(adderr)?,
HorizontalAlignment::Right => self.solver
HorizontalAlignment::Right => self
.solver
.add_constraint(state.left | EQ(STRONG) | parent_width - state.width)
.map_err(adderr)?,
HorizontalAlignment::Center => self.solver
HorizontalAlignment::Center => self
.solver
.add_constraint(state.left | EQ(STRONG) | (parent_width - state.width) / 2.0)
.map_err(adderr)?,
}
match state.constraints.valign {
VerticalAlignment::Top => self.solver
VerticalAlignment::Top => self
.solver
.add_constraint(state.top | EQ(STRONG) | 0.0)
.map_err(adderr)?,
VerticalAlignment::Bottom => self.solver
VerticalAlignment::Bottom => self
.solver
.add_constraint(state.top | EQ(STRONG) | parent_height - state.height)
.map_err(adderr)?,
VerticalAlignment::Middle => self.solver
VerticalAlignment::Middle => self
.solver
.add_constraint(state.top | EQ(STRONG) | (parent_height - state.height) / 2.0)
.map_err(adderr)?,
}
@ -438,17 +446,20 @@ impl LayoutState {
)?;
match child_state.constraints.halign {
HorizontalAlignment::Left => self.solver
HorizontalAlignment::Left => self
.solver
.add_constraint(child_state.left | EQ(STRONG) | left_edge.clone())
.map_err(adderr)?,
HorizontalAlignment::Right => self.solver
HorizontalAlignment::Right => self
.solver
.add_constraint(
child_state.left + child_state.width
| EQ(STRONG)
| state.left + state.width,
)
.map_err(adderr)?,
HorizontalAlignment::Center => self.solver
HorizontalAlignment::Center => self
.solver
.add_constraint(
child_state.left
| EQ(STRONG)
@ -458,17 +469,20 @@ impl LayoutState {
}
match child_state.constraints.valign {
VerticalAlignment::Top => self.solver
VerticalAlignment::Top => self
.solver
.add_constraint(child_state.top | EQ(STRONG) | top_edge.clone())
.map_err(adderr)?,
VerticalAlignment::Bottom => self.solver
VerticalAlignment::Bottom => self
.solver
.add_constraint(
child_state.top + child_state.height
| EQ(STRONG)
| state.top + state.height,
)
.map_err(adderr)?,
VerticalAlignment::Middle => self.solver
VerticalAlignment::Middle => self
.solver
.add_constraint(
child_state.top
| EQ(STRONG)