parameterized icon indicating copy to clipboard operation
parameterized copied to clipboard

Attribute argument / function parameter amount mismatch: improve error message

Open foresterre opened this issue 5 years ago • 0 comments

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);
        }

foresterre avatar Nov 13 '19 17:11 foresterre