style: fix formatting and clippy issues

pull/197/head
Florian Dehau 5 years ago
parent a82c82fcd7
commit 816bc9b5c8

@ -520,12 +520,8 @@ mod tests {
#[test] #[test]
fn buffer_with_lines() { fn buffer_with_lines() {
let buffer = Buffer::with_lines(vec![ let buffer =
"┌────────┐", Buffer::with_lines(vec!["┌────────┐", "│コンピュ│", "│ーa 上で│", "└────────┘"]);
"│コンピュ│",
"│ーa 上で│",
"└────────┘",
]);
assert_eq!(buffer.area.x, 0); assert_eq!(buffer.area.x, 0);
assert_eq!(buffer.area.y, 0); assert_eq!(buffer.area.y, 0);
assert_eq!(buffer.area.width, 10); assert_eq!(buffer.area.width, 10);
@ -619,11 +615,7 @@ mod tests {
let diff = prev.diff(&next); let diff = prev.diff(&next);
assert_eq!( assert_eq!(
diff, diff,
vec![ vec![(1, 0, &cell("─")), (2, 0, &cell("称")), (4, 0, &cell("号")),]
(1, 0, &cell("─")),
(2, 0, &cell("称")),
(4, 0, &cell("号")),
]
); );
} }

@ -130,13 +130,14 @@ where
} }
pub fn widths(mut self, widths: &'a [Constraint]) -> Table<'a, T, H, I, D, R> { pub fn widths(mut self, widths: &'a [Constraint]) -> Table<'a, T, H, I, D, R> {
let between_0_and_100 = |&w| {
match w {
Constraint::Percentage(p) => p <= 100,
_ => true,
}
};
assert!( assert!(
widths.iter().all(|w| { widths.iter().all(between_0_and_100),
match w {
Constraint::Percentage(p) => *p <= 100,
_ => true,
}
}),
"Percentages should be between 0 and 100 inclusively." "Percentages should be between 0 and 100 inclusively."
); );
self.widths = widths; self.widths = widths;
@ -270,5 +271,4 @@ mod tests {
Table::new([""].iter(), vec![Row::Data([""].iter())].into_iter()) Table::new([""].iter(), vec![Row::Data([""].iter())].into_iter())
.widths(&[Constraint::Percentage(110)]); .widths(&[Constraint::Percentage(110)]);
} }
} }

@ -82,8 +82,7 @@ fn paragraph_render_double_width() {
let backend = TestBackend::new(10, 10); let backend = TestBackend::new(10, 10);
let mut terminal = Terminal::new(backend).unwrap(); let mut terminal = Terminal::new(backend).unwrap();
let s = let s = "コンピュータ上で文字を扱う場合、典型的には文字による通信を行う場合にその両端点では、";
"コンピュータ上で文字を扱う場合、典型的には文字による通信を行う場合にその両端点では、";
terminal terminal
.draw(|mut f| { .draw(|mut f| {
let size = f.size(); let size = f.size();

Loading…
Cancel
Save