Skip to content

Prefer to assert_eq!(a, Ok(b)) rather than assert_eq!(a.unwrap(), b) #338

@petertseng

Description

@petertseng

In #292 (comment) we decided that asserting equality to an Ok gives better error messages than attempting to unwrap (which panics if the observed value is an Err instead of Ok).

We should try to adhere to this.

Find instances of unwrap in asserts by using git grep 'assert.*unwrap' (or git grep unwrap exercises/*/tests for a larger hammer) and remove the unwraps by changing the other argument to an Ok).

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueAn improvement or bug fix that favors new contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions