1
Fork 0

Rollup merge of #89778 - jkugelman:must-use-as_type-conversions, r=joshtriplett

Add #[must_use] to as_type conversions

Clippy missed these:

```rust
alloc::string::String   fn as_mut_str(&mut self) -> &mut str;
core::mem::NonNull<T>   unsafe fn as_uninit_mut<'a>(&mut self) -> &'a MaybeUninit<T>;
str                     unsafe fn as_bytes_mut(&mut self) -> &mut [u8];
str                     fn as_mut_ptr(&mut self) -> *mut u8;
```

Parent issue: #89692

r? ````@joshtriplett````
This commit is contained in:
the8472 2021-10-12 14:53:08 +02:00 committed by GitHub
commit b55a3c5d15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 54 additions and 0 deletions

View file

@ -2093,6 +2093,7 @@ impl<T: ?Sized> Weak<T> {
/// ```
///
/// [`null`]: ptr::null
#[must_use]
#[stable(feature = "rc_as_ptr", since = "1.45.0")]
pub fn as_ptr(&self) -> *const T {
let ptr: *mut RcBox<T> = NonNull::as_ptr(self.ptr);