mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-10 07:04:17 +00:00
style: fix formatting and clippy issues
This commit is contained in:
parent
a82c82fcd7
commit
816bc9b5c8
3 changed files with 11 additions and 20 deletions
|
@ -520,12 +520,8 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn buffer_with_lines() {
|
||||
let buffer = Buffer::with_lines(vec![
|
||||
"┌────────┐",
|
||||
"│コンピュ│",
|
||||
"│ーa 上で│",
|
||||
"└────────┘",
|
||||
]);
|
||||
let buffer =
|
||||
Buffer::with_lines(vec!["┌────────┐", "│コンピュ│", "│ーa 上で│", "└────────┘"]);
|
||||
assert_eq!(buffer.area.x, 0);
|
||||
assert_eq!(buffer.area.y, 0);
|
||||
assert_eq!(buffer.area.width, 10);
|
||||
|
@ -619,11 +615,7 @@ mod tests {
|
|||
let diff = prev.diff(&next);
|
||||
assert_eq!(
|
||||
diff,
|
||||
vec![
|
||||
(1, 0, &cell("─")),
|
||||
(2, 0, &cell("称")),
|
||||
(4, 0, &cell("号")),
|
||||
]
|
||||
vec![(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> {
|
||||
let between_0_and_100 = |&w| {
|
||||
match w {
|
||||
Constraint::Percentage(p) => p <= 100,
|
||||
_ => true,
|
||||
}
|
||||
};
|
||||
assert!(
|
||||
widths.iter().all(|w| {
|
||||
match w {
|
||||
Constraint::Percentage(p) => *p <= 100,
|
||||
_ => true,
|
||||
}
|
||||
}),
|
||||
widths.iter().all(between_0_and_100),
|
||||
"Percentages should be between 0 and 100 inclusively."
|
||||
);
|
||||
self.widths = widths;
|
||||
|
@ -270,5 +271,4 @@ mod tests {
|
|||
Table::new([""].iter(), vec![Row::Data([""].iter())].into_iter())
|
||||
.widths(&[Constraint::Percentage(110)]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,8 +82,7 @@ fn paragraph_render_double_width() {
|
|||
let backend = TestBackend::new(10, 10);
|
||||
let mut terminal = Terminal::new(backend).unwrap();
|
||||
|
||||
let s =
|
||||
"コンピュータ上で文字を扱う場合、典型的には文字による通信を行う場合にその両端点では、";
|
||||
let s = "コンピュータ上で文字を扱う場合、典型的には文字による通信を行う場合にその両端点では、";
|
||||
terminal
|
||||
.draw(|mut f| {
|
||||
let size = f.size();
|
||||
|
|
Loading…
Reference in a new issue