-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add #[must_use] to remaining core functions #89897
Conversation
5fdde08
to
d40f562
Compare
I left a comment on two functions that I think should not have |
d40f562
to
68b0d86
Compare
@joshtriplett What does |
@jkugelman If someone says "r=me with xyz fixed", that means "anyone with permission who comes along later is welcome to |
@bors r+ |
📌 Commit 68b0d86 has been approved by |
…lett 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: rust-lang#89692 r? `@joshtriplett`
…lett 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: rust-lang#89692 r? ``@joshtriplett``
…askrgr Rollup of 8 pull requests Successful merges: - rust-lang#89446 (Add paragraph to ControlFlow docs to menion it works with the ? operator (rust-lang#88715)) - rust-lang#89677 (Stabilize `is_symlink()` for `Metadata` and `Path`) - rust-lang#89833 (Add #[must_use] to Rc::downgrade) - rust-lang#89835 (Add #[must_use] to expensive computations) - rust-lang#89839 (Add #[must_use] to mem/ptr functions) - rust-lang#89897 (Add #[must_use] to remaining core functions) - rust-lang#89951 (Stabilize `option_result_unwrap_unchecked`) - rust-lang#90427 (Add #[must_use] to alloc functions that would leak memory) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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:
Ignored by clippy because of
mut
:Ignored by clippy presumably because a caller might want `f` called for side effects. That seems like a bad usage of `map` to me.
Parent issue: #89692
r? @joshtriplett