Skip to content

circular_buffer: Shall we remove allow(unused_must_use)? #475

Closed
@petertseng

Description

@petertseng

You will observe that https://github.com/exercism/rust/blob/master/exercises/circular-buffer/tests/circular-buffer.rs contains an allow(unused_must_use) to avoid compiler warnings (and thus a CI rejection, since our CI rejects warnings) from the fact that many Results from write are ignored.

Shall we instead use let _ = buffer.write(...) ?

The advantage is that it is more precise about exactly which lines are ignoring a Result rather than casting a wide net over the entire test module.

It would also allow us to remove an mod tests that is present in only circular-buffer probably for the sole reason of scoping the #[allow(...)]

The disadvantage is that since there may be other reasons to use let _ = ... it makes it hard to grep the entire repo to determine what's ignoring a Result and what is using let _ = ... for other reasons.

The circular-buffer was added in #52 at which time there was no discussion of this point.

The other exercise that prominently uses let _ = ... is Bowling; the discussion may be seen around #213 (comment) and a few surrounding comments (such as #213 (comment))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions