]> git.lizzy.rs Git - rust.git/commit
Auto merge of #89755 - jkugelman:must-use-conversions-that-move-self, r=joshtriplett
authorbors <bors@rust-lang.org>
Mon, 11 Oct 2021 07:27:44 +0000 (07:27 +0000)
committerbors <bors@rust-lang.org>
Mon, 11 Oct 2021 07:27:44 +0000 (07:27 +0000)
commit86d6d2b7389fe1b339402c1798edae8b695fc9ef
tree88c37951da1bbc2c46818b1705d6fa5e962eae5b
parent9a757817c352801de8b0593728f8aee21e23cd53
parentb115781bcd0609e94c08192924853097c73f1a1c
Auto merge of #89755 - jkugelman:must-use-conversions-that-move-self, r=joshtriplett

Add #[must_use] to conversions that move self

Everything here got the same message. Is the wording okay?

```rust
#[must_use = "`self` will be dropped if the result is not used"]
```

I want to draw attention to these methods in particular:

```rust
alloc::sync::Arc<MaybeUninit<T>>     unsafe fn assume_init(self) -> Arc<T>;
alloc::sync::Arc<[MaybeUninit<T>]>   unsafe fn assume_init(self) -> Arc<[T]>;
core::pin::Pin<&'a mut T>            const fn into_ref(self) -> Pin<&'a T>;
core::pin::Pin<&'a mut T>            const fn get_mut(self) -> &'a mut T;
core::pin::Pin<&'a mut T>            const unsafe fn get_unchecked_mut(self) -> &'a mut T;
core::pin::Pin<&'a mut T>            unsafe fn map_unchecked_mut(self, func: F) -> Pin<&'a mut U>;
core::pin::Pin<&'a mut Pin<P>>       fn as_deref_mut(self) -> Pin<&'a mut P::Target>;
```

Parent issue: #89692

r? `@joshtriplett`