aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2023-02-05 14:09:08 -0500
committerJesse Luehrs <doy@tozt.net>2023-02-05 14:09:08 -0500
commit0cf00851dc88ed8013a35747c803b6c83db83761 (patch)
treebcc056c47b464de63b40427ef1f33c541b06cdfb /tests/helpers
parentf77f754a6ebe8eeabaced9caaad710bac8582ab1 (diff)
downloadvt100-rust-0cf00851dc88ed8013a35747c803b6c83db83761.tar.gz
vt100-rust-0cf00851dc88ed8013a35747c803b6c83db83761.zip
clippy
Diffstat (limited to 'tests/helpers')
-rw-r--r--tests/helpers/fixtures.rs19
-rw-r--r--tests/helpers/mod.rs4
2 files changed, 10 insertions, 13 deletions
diff --git a/tests/helpers/fixtures.rs b/tests/helpers/fixtures.rs
index c0f8b75..bc39926 100644
--- a/tests/helpers/fixtures.rs
+++ b/tests/helpers/fixtures.rs
@@ -96,7 +96,7 @@ impl FixtureScreen {
let cell = screen.cell(row, col).unwrap();
if cell != &vt100::Cell::default() {
cells.insert(
- format!("{},{}", row, col),
+ format!("{row},{col}"),
FixtureCell::from_cell(cell),
);
}
@@ -159,8 +159,8 @@ where
{
let s = match color {
vt100::Color::Default => unreachable!(),
- vt100::Color::Idx(n) => format!("{}", n),
- vt100::Color::Rgb(r, g, b) => format!("#{:02x}{:02x}{:02x}", r, g, b),
+ vt100::Color::Idx(n) => format!("{n}"),
+ vt100::Color::Rgb(r, g, b) => format!("#{r:02x}{g:02x}{b:02x}"),
};
serializer.serialize_str(&s)
}
@@ -231,8 +231,7 @@ where
fn load_input(name: &str, i: usize) -> Option<Vec<u8>> {
let mut file = std::fs::File::open(format!(
- "tests/data/fixtures/{}/{}.typescript",
- name, i
+ "tests/data/fixtures/{name}/{i}.typescript"
))
.ok()?;
let mut input = vec![];
@@ -241,11 +240,9 @@ fn load_input(name: &str, i: usize) -> Option<Vec<u8>> {
}
fn load_screen(name: &str, i: usize) -> Option<FixtureScreen> {
- let mut file = std::fs::File::open(format!(
- "tests/data/fixtures/{}/{}.json",
- name, i
- ))
- .ok()?;
+ let mut file =
+ std::fs::File::open(format!("tests/data/fixtures/{name}/{i}.json"))
+ .ok()?;
Some(FixtureScreen::load(&mut file))
}
@@ -281,7 +278,7 @@ fn assert_produces(input: &[u8], expected: &FixtureScreen) {
for col in 0..cols {
let expected_cell = expected
.cells
- .get(&format!("{},{}", row, col))
+ .get(&format!("{row},{col}"))
.cloned()
.unwrap_or_default();
let got_cell = parser.screen().cell(row, col).unwrap();
diff --git a/tests/helpers/mod.rs b/tests/helpers/mod.rs
index dc08ce5..67bb1f4 100644
--- a/tests/helpers/mod.rs
+++ b/tests/helpers/mod.rs
@@ -46,7 +46,7 @@ impl<'a> std::fmt::Debug for Bytes<'a> {
13 => f.write_str("\\r")?,
92 => f.write_str("\\\\")?,
32..=126 => f.write_str(&char::from(*c).to_string())?,
- _ => f.write_fmt(format_args!("\\x{:02x}", c))?,
+ _ => f.write_fmt(format_args!("\\x{c:02x}"))?,
}
}
f.write_str("\"")?;
@@ -267,7 +267,7 @@ pub fn format_bytes(bytes: &[u8]) -> String {
13 => v.extend(b"\\r"),
27 => v.extend(b"\\e"),
c if c < 32 || c == 127 => {
- v.extend(format!("\\x{:02x}", c).as_bytes())
+ v.extend(format!("\\x{c:02x}").as_bytes())
}
b => v.push(b),
}