mirror of
https://github.com/ratatui-org/ratatui
synced 2025-02-18 06:58:51 +00:00
chore: lint and doc cleanup (#191)
* chore: Lint and doc cleanup A few more minor cleanups, mostly in documentation * Remove unused comment
This commit is contained in:
parent
77067bdc58
commit
509d18501c
6 changed files with 19 additions and 19 deletions
12
Cargo.toml
12
Cargo.toml
|
@ -32,19 +32,19 @@ cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "2.3"
|
bitflags = "2.3"
|
||||||
cassowary = "0.3"
|
cassowary = "0.3"
|
||||||
|
crossterm = { version = "0.26", optional = true }
|
||||||
|
indoc = "2.0"
|
||||||
|
serde = { version = "1", optional = true, features = ["derive"]}
|
||||||
|
termion = { version = "2.0", optional = true }
|
||||||
|
termwiz = { version = "0.20.0", optional = true }
|
||||||
|
time = { version = "0.3.11", optional = true, features = ["local-offset"]}
|
||||||
unicode-segmentation = "1.10"
|
unicode-segmentation = "1.10"
|
||||||
unicode-width = "0.1"
|
unicode-width = "0.1"
|
||||||
termion = { version = "2.0", optional = true }
|
|
||||||
crossterm = { version = "0.26", optional = true }
|
|
||||||
termwiz = { version = "0.20.0", optional = true }
|
|
||||||
serde = { version = "1", optional = true, features = ["derive"]}
|
|
||||||
time = { version = "0.3.11", optional = true, features = ["local-offset"]}
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
anyhow = "1.0.71"
|
anyhow = "1.0.71"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
argh = "0.1"
|
argh = "0.1"
|
||||||
indoc = "2.0"
|
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "barchart"
|
name = "barchart"
|
||||||
|
|
|
@ -36,9 +36,7 @@ pub trait Backend {
|
||||||
I: Iterator<Item = (u16, u16, &'a Cell)>;
|
I: Iterator<Item = (u16, u16, &'a Cell)>;
|
||||||
|
|
||||||
/// Insert `n` line breaks to the terminal screen
|
/// Insert `n` line breaks to the terminal screen
|
||||||
fn append_lines(&mut self, n: u16) -> io::Result<()> {
|
fn append_lines(&mut self, _n: u16) -> io::Result<()> {
|
||||||
// to get around the unused warning
|
|
||||||
let _n = n;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -503,7 +503,11 @@ macro_rules! assert_buffer_eq {
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(i, (x, y, cell))| {
|
.map(|(i, (x, y, cell))| {
|
||||||
let expected_cell = expected.get(*x, *y);
|
let expected_cell = expected.get(*x, *y);
|
||||||
format!("{i}: at ({x}, {y})\n expected: {expected_cell:?}\n actual: {cell:?}")
|
indoc::formatdoc! {"
|
||||||
|
{i}: at ({x}, {y})
|
||||||
|
expected: {expected_cell:?}
|
||||||
|
actual: {cell:?}
|
||||||
|
"}
|
||||||
})
|
})
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>()
|
||||||
.join("\n");
|
.join("\n");
|
||||||
|
@ -531,12 +535,10 @@ impl Debug for Buffer {
|
||||||
/// Writes a debug representation of the buffer to the given formatter.
|
/// Writes a debug representation of the buffer to the given formatter.
|
||||||
///
|
///
|
||||||
/// The format is like a pretty printed struct, with the following fields:
|
/// The format is like a pretty printed struct, with the following fields:
|
||||||
/// area: displayed as Rect { x: 1, y: 2, width: 3, height: 4 }
|
/// * `area`: displayed as `Rect { x: 1, y: 2, width: 3, height: 4 }`
|
||||||
/// content: displayed as a list of strings representing the content of the
|
/// * `content`: displayed as a list of strings representing the content of the buffer
|
||||||
/// buffer
|
/// * `styles`: displayed as a list of: `{ x: 1, y: 2, fg: Color::Red, bg: Color::Blue,
|
||||||
/// styles: displayed as a list of
|
/// modifier: Modifier::BOLD }` only showing a value when there is a change in style.
|
||||||
/// { x: 1, y: 2, fg: Color::Red, bg: Color::Blue, modifier: Modifier::BOLD }
|
|
||||||
/// only showing a value when there is a change in style.
|
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
||||||
f.write_fmt(format_args!(
|
f.write_fmt(format_args!(
|
||||||
"Buffer {{\n area: {:?},\n content: [\n",
|
"Buffer {{\n area: {:?},\n content: [\n",
|
||||||
|
|
|
@ -522,7 +522,7 @@ mod tests {
|
||||||
- f64::from(width) / f64::from(height))
|
- f64::from(width) / f64::from(height))
|
||||||
.abs()
|
.abs()
|
||||||
< 1.0
|
< 1.0
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CompletedFrame represents the state of the terminal after all changes performed in the last
|
/// `CompletedFrame` represents the state of the terminal after all changes performed in the last
|
||||||
/// [`Terminal::draw`] call have been applied. Therefore, it is only valid until the next call to
|
/// [`Terminal::draw`] call have been applied. Therefore, it is only valid until the next call to
|
||||||
/// [`Terminal::draw`].
|
/// [`Terminal::draw`].
|
||||||
pub struct CompletedFrame<'a> {
|
pub struct CompletedFrame<'a> {
|
||||||
|
|
|
@ -496,7 +496,7 @@ mod test {
|
||||||
"mnopab cdefghi j",
|
"mnopab cdefghi j",
|
||||||
"klmno",
|
"klmno",
|
||||||
]
|
]
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Reference in a new issue