# Must\_use and linear types

**URL:** <https://internals.rust-lang.org/t/must-use-and-linear-types/12736>\
**Category:** language design\
**Created:** [July 15, 2020, 11:44am UTC](https://internals.rust-lang.org/t/must-use-and-linear-types/12736 "2020-07-15T11:44:43Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![PoignardAzur](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/poignardazur/32/6464_2.png) [@PoignardAzur](https://internals.rust-lang.org/u/PoignardAzur)\
**Post date:** [July 31, 2020, 9:08am UTC](https://internals.rust-lang.org/t/must-use-and-linear-types/12736/21 "2020-07-31T09:08:46Z")

</div>

> [@robinm](#):
>
> Couldn't this be fixed at an edition boundary?

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.

---

<div class="post-metadata">

**Author:** ![dhm](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/dhm/32/4879_2.png) [@dhm](https://internals.rust-lang.org/u/dhm)\
**Post date:** [August 1, 2020, 10:55pm UTC](https://internals.rust-lang.org/t/must-use-and-linear-types/12736/22 "2020-08-01T22:55:56Z")

</div>

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:

```rust
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:

```rust
impl<E> Result<(), E> {
    /// Succint, and yet conveys a very clear meaning, even to beginners.
    fn ignore_err (self) // or .ignored() % bikeshed
    {}
}

```

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [October 30, 2020, 10:56pm UTC](https://internals.rust-lang.org/t/must-use-and-linear-types/12736/23 "2020-10-30T22:56:03Z")

</div>

Closed on October 30, 2020, 10:56pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

[Previous page](https://internals.rust-lang.org/t/must-use-and-linear-types/12736.md?page=1)
