I feel like the more the 2021 deadline approaches, the more everyone wants to fit everything into an edition change, but we should try to remember that edition-boundary changes aren't free.
I think the status quo works well enough for 90% of cases.
I feel like the more the 2021 deadline approaches, the more everyone wants to fit everything into an edition change, but we should try to remember that edition-boundary changes aren't free.
I think the status quo works well enough for 90% of cases.
Given the discussion about let _
misusage, it does seem like that could become an antipattern, at which point drop
ought to be the go-to replacement to quiet #[must_use]
values. In the very specific case of Result
, however, drop
does not feel or read right:
I don't like how drop(fs::remove_dir_all(...))
looks like.
I remember having added a custom extension trait on Result
to have something akin to what @kornel mentioned:
fs::remove_dir_all(...).ignore_err();
and I do think (again, given how shotgunny let _
appears to be) that adding that to the std
(core
) lib wouldn't hurt:
impl<E> Result<(), E> {
/// Succint, and yet conveys a very clear meaning, even to beginners.
fn ignore_err (self) // or .ignored() % bikeshed
{}
}
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.