rust/library/std/src/sync
Guillaume Gomez 07f43a1ca1
Rollup merge of #97739 - a2aaron:let_underscore, r=estebank
Uplift the `let_underscore` lints from clippy into rustc.

This PR resolves #97241.

This PR adds three lints from clippy--`let_underscore_drop`, `let_underscore_lock`, and `let_underscore_must_use`, which are meant to capture likely-incorrect uses of `let _ = ...` bindings (in particular, doing this on a type with a non-trivial `Drop` causes the `Drop` to occur immediately, instead of at the end of the scope. For a type like `MutexGuard`, this effectively releases the lock immediately, which is almost certainly the wrong behavior)

In porting the lints from clippy I had to copy over a bunch of utility functions from `clippy_util` that these lints also relied upon. Is that the right approach?

Note that I've set the `must_use` and `drop` lints to Allow by default and set `lock` to Deny by default (this matches the same settings that clippy has). In talking with `@estebank` he informed me to do a Crater run (I am not sure what type of Crater run to request here--I think it's just "check only"?)

On the linked issue, there's some discussion about using `must_use` and `Drop` together as a heuristic for when to warn--I did not implement this yet.

r? `@estebank`
2022-09-02 11:34:45 +02:00
..
barrier std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
condvar Remove condvar::two_mutexes test. 2022-05-05 21:47:13 +02:00
lazy_lock Move/rename lazy::Sync{OnceCell,Lazy} to sync::{Once,Lazy}Lock 2022-06-16 19:54:42 +04:00
mpsc make many std tests work in Miri 2022-08-18 18:07:39 -04:00
mutex Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
once Stabilize poison API of Once, rename poisoned() 2021-02-04 15:20:14 +01:00
once_lock Move/rename lazy::Sync{OnceCell,Lazy} to sync::{Once,Lazy}Lock 2022-06-16 19:54:42 +04:00
rwlock make many std tests work in Miri 2022-08-18 18:07:39 -04:00
barrier.rs Rollup merge of #87440 - twetzel59:fix-barrier-no-op, r=yaahc 2021-10-21 14:11:02 +09:00
condvar.rs Make {Mutex, Condvar, RwLock}::new() const. 2022-06-06 13:55:43 +02:00
lazy_lock.rs Move/rename lazy::Sync{OnceCell,Lazy} to sync::{Once,Lazy}Lock 2022-06-16 19:54:42 +04:00
mod.rs Rollup merge of #97629 - guswynn:exclusive_struct, r=m-ou-se 2022-06-30 19:55:50 +02:00
mutex.rs Rollup merge of #97739 - a2aaron:let_underscore, r=estebank 2022-09-02 11:34:45 +02:00
once.rs Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
once_lock.rs Move/rename lazy::Sync{OnceCell,Lazy} to sync::{Once,Lazy}Lock 2022-06-16 19:54:42 +04:00
poison.rs Auto merge of #97791 - m-ou-se:const-locks, r=m-ou-se 2022-06-19 08:20:36 +00:00
rwlock.rs Rollup merge of #97739 - a2aaron:let_underscore, r=estebank 2022-09-02 11:34:45 +02:00