parameterized
parameterized copied to clipboard
Attribute argument / function parameter amount mismatch: improve error message
The following code will obvisouly fail, since our function has two inputs, but in our attribute, we only provide one.
#[parameterized(input = {
&["03579", "0", "1", "1"]
})]
fn should_fail(input: &[&str], expected: (u32, u32, u32, u32)) {
let some: (u32, u32, u32, u32) = ParseInputsFromIter::parse(input).unwrap();
assert_eq!(some, expected);
}
it does fail (which is good), but the error states "this should never happen", while it can and isn't an unreachable error case.
#[parameterized(input = {
&["03579", "0", "1", "1"]
})]
fn should_fail(input: &[&str], expected: (u32, u32, u32, u32)) {
let some: (u32, u32, u32, u32) = ParseInputsFromIter::parse(input).unwrap();
assert_eq!(some, expected);
}