]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Rollup merge of #89897 - jkugelman:must-use-core, r=joshtriplett
authorMatthias Krüger <matthias.krueger@famsik.de>
Sun, 31 Oct 2021 08:20:26 +0000 (09:20 +0100)
committerGitHub <noreply@github.com>
Sun, 31 Oct 2021 08:20:26 +0000 (09:20 +0100)
commit95750ae4394b4575df24e2d1484a823ca2988231
treec3738f46c9177db3d9c27d017df7aa1b9fc4d198
parente79e9f5e2a21e5cd0c17c051c8d3e47387733f98
parent68b0d862945782f215f39980d6ac9ffabdb2031c
Rollup merge of #89897 - jkugelman:must-use-core, r=joshtriplett

Add #[must_use] to remaining core functions

I've run out of compelling reasons to group functions together across crates so I'm just going to go module-by-module. This is everything remaining from the `core` crate.

Ignored by clippy for reasons unknown:

```rust
core::alloc::Layout   unsafe fn for_value_raw<T: ?Sized>(t: *const T) -> Self;
core::any             const fn type_name_of_val<T: ?Sized>(_val: &T) -> &'static str;
```

Ignored by clippy because of `mut`:

```rust
str   fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str);
```

<del>
Ignored by clippy presumably because a caller might want `f` called for side effects. That seems like a bad usage of `map` to me.

```rust
core::cell::Ref<'b, T>   fn map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Ref<'b, T>;
core::cell::Ref<'b, T>   fn map_split<U: ?Sized, V: ?Sized, F>(orig: Ref<'b, T>, f: F) -> (Ref<'b, U>, Ref<'b, V>);
```
</del>

Parent issue: #89692

r? ```@joshtriplett```
12 files changed:
library/core/src/cell.rs
library/core/src/fmt/mod.rs
library/core/src/num/error.rs
library/core/src/num/f32.rs
library/core/src/num/f64.rs
library/core/src/option.rs
library/core/src/panic/panic_info.rs
library/core/src/slice/iter.rs
library/core/src/str/iter.rs
library/core/src/str/mod.rs
library/core/src/str/validations.rs
library/core/src/time.rs