Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proptest! macro triggers clippy::unnecessary_operation #183

Open
Byter09 opened this issue Mar 9, 2020 · 1 comment
Open

proptest! macro triggers clippy::unnecessary_operation #183

Byter09 opened this issue Mar 9, 2020 · 1 comment

Comments

@Byter09
Copy link

Byter09 commented Mar 9, 2020

Hello.

The following test triggers clippy::unnecessary_operation...

proptest! {
    #[test]
    fn proptest_sizeof_multiple_of_alignof(t in arb_type()) {
        if let Ok(sizeof) = t.sizeof() {
            prop_assert_eq!(sizeof % t.alignof().unwrap(), 0);
        }
    }
}

... probably because the expansion ends up with this:

match runner.run( 
    ...
) {
    Ok(_) => (),
    Err(e) => panic!(),
}

If there's a better way to express/rewrite the test, I'd prefer that of course.
Otherwise I hope it's not causing too much trouble by kindly requesting #[allow(clippy::unnecessary_operation)] to be added.

Thank you.

@znewman01
Copy link

FYI this might be better addressed upstream.

Clippy is in the middle of trying to work out which lints should/shouldn't trigger for external macros: rust-clippy#4949, rust-clippy#5362. They've been receptive when requesting similar things for other lints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants