Skip to content

Enable clippy::assertions_on_result_states for tests #337

@roypat

Description

@roypat

Our unit tests do a lot of assert!((...).is_ok()) or assert!((...).is_err()), which in case of test failures produces very unhelpful messages (e.g. if an assertion on is_ok() fails, it just prints "assert failed: false", without printing what the error variant that we actually received was). The .is_ok() assertions, we can just replace with .unwrap()s, while the is_err() assertions can either become .unwrap_err(), if we dont care about the actual error returned, or assert_matches!((...).unwrap_err(), expected error), if we do. After this is all set and done, we should add #![warn(clippy(assertions_on_result_states)] to lib.rs.

This is mostly busywork, and there are around 50 instances of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions