diff options
Diffstat (limited to 'tests/helpers')
-rw-r--r-- | tests/helpers/fixtures.rs | 19 | ||||
-rw-r--r-- | tests/helpers/mod.rs | 4 |
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), } |