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:
Yuri Astrakhan 2023-06-02 10:03:34 -04:00 committed by GitHub
parent 77067bdc58
commit 509d18501c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 19 deletions

View file

@ -32,19 +32,19 @@ cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
[dependencies]
bitflags = "2.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-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]
anyhow = "1.0.71"
rand = "0.8"
argh = "0.1"
indoc = "2.0"
[[example]]
name = "barchart"

View file

@ -36,9 +36,7 @@ pub trait Backend {
I: Iterator<Item = (u16, u16, &'a Cell)>;
/// Insert `n` line breaks to the terminal screen
fn append_lines(&mut self, n: u16) -> io::Result<()> {
// to get around the unused warning
let _n = n;
fn append_lines(&mut self, _n: u16) -> io::Result<()> {
Ok(())
}

View file

@ -503,7 +503,11 @@ macro_rules! assert_buffer_eq {
.enumerate()
.map(|(i, (x, y, cell))| {
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>>()
.join("\n");
@ -531,12 +535,10 @@ impl Debug for Buffer {
/// Writes a debug representation of the buffer to the given formatter.
///
/// The format is like a pretty printed struct, with the following fields:
/// area: displayed as Rect { x: 1, y: 2, width: 3, height: 4 }
/// content: displayed as a list of strings representing the content of the
/// buffer
/// styles: displayed as a list of
/// { x: 1, y: 2, fg: Color::Red, bg: Color::Blue, modifier: Modifier::BOLD }
/// only showing a value when there is a change in style.
/// * `area`: displayed as `Rect { x: 1, y: 2, width: 3, height: 4 }`
/// * `content`: displayed as a list of strings representing the content of the buffer
/// * `styles`: displayed as a list of: `{ 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 {
f.write_fmt(format_args!(
"Buffer {{\n area: {:?},\n content: [\n",

View file

@ -522,7 +522,7 @@ mod tests {
- f64::from(width) / f64::from(height))
.abs()
< 1.0
)
);
}
}

View file

@ -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`].
pub struct CompletedFrame<'a> {

View file

@ -496,7 +496,7 @@ mod test {
"mnopab cdefghi j",
"klmno",
]
)
);
}
#[test]