[domistream] Tests: first compile, clippy clean

Temporaries borrowed past their statement (control, media), clippy's
is_multiple_of, needless index loop and type complexity. input.rs: the
MOUSE_MOVE_ABS builder dropped the y field; the PROTOCOL.md cross-check would
have caught it at runtime.
This commit is contained in:
2026-11-25 13:08:24 +01:00
parent 8d0bebfbc3
commit 2740d3dd45
7 changed files with 19 additions and 12 deletions
+8 -3
View File
@@ -42,8 +42,13 @@ fn check(what: &str, input: &[u8], f: impl FnOnce(&[u8])) {
);
}
fn lying_inputs() -> Vec<(&'static str, Vec<u8>, fn(&[u8]))> {
let mut v: Vec<(&'static str, Vec<u8>, fn(&[u8]))> = Vec::new();
/// A parser under test: a name and a call that consumes the input.
type Parser = (&'static str, fn(&[u8]));
/// A parser and the hostile input for it.
type Case = (&'static str, Vec<u8>, fn(&[u8]));
fn lying_inputs() -> Vec<Case> {
let mut v: Vec<Case> = Vec::new();
// RTSP: Content-Length claims 4 GiB.
let rtsp = b"RTSP/1.0 200 OK\r\nCSeq: 1\r\nContent-Length: 4294967295\r\n\r\nabc".to_vec();
@@ -220,7 +225,7 @@ fn parsers_never_allocate_past_their_caps() {
// Arbitrary inputs to every stateless parser.
let mut runner = TestRunner::new(Config { cases: 400, ..Config::default() });
let parsers: Vec<(&str, fn(&[u8]))> = vec![
let parsers: Vec<Parser> = vec![
("xml", |b| {
let _ = domistream::http::xml::parse(b);
}),