mirror of
https://github.com/ratatui/ratatui.git
synced 2025-10-02 15:25:54 +00:00
style: fix formatting and clippy issues
This commit is contained in:
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> {
|
||||||
assert!(
|
let between_0_and_100 = |&w| {
|
||||||
widths.iter().all(|w| {
|
|
||||||
match w {
|
match w {
|
||||||
Constraint::Percentage(p) => *p <= 100,
|
Constraint::Percentage(p) => p <= 100,
|
||||||
_ => true,
|
_ => true,
|
||||||
}
|
}
|
||||||
}),
|
};
|
||||||
|
assert!(
|
||||||
|
widths.iter().all(between_0_and_100),
|
||||||
"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…
x
Reference in New Issue
Block a user