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))
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 fromwriteare ignored.Shall we instead use
let _ = buffer.write(...)?The advantage is that it is more precise about exactly which lines are ignoring a
Resultrather than casting a wide net over the entire test module.It would also allow us to remove an
mod teststhat 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 usinglet _ = ...for other reasons.The
circular-bufferwas 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))