diff options
| author | Philipp Krones <hello@philkrones.com> | 2022-11-21 19:59:07 +0100 |
|---|---|---|
| committer | Philipp Krones <hello@philkrones.com> | 2022-11-21 20:01:17 +0100 |
| commit | fd5b85c957d92a3bc5fc754407d1e56aa9178d27 (patch) | |
| tree | cba25a7cb16b8f5981eb75b1138ece61bb412fb6 /src/docs/mutex_atomic.txt | |
| parent | 80a4699aaeb17903cd55c3159764febf3ff4e7e9 (diff) | |
| parent | 51ec465cc3dfb62a2dad7e808b399fa76a1c9170 (diff) | |
Merge remote-tracking branch 'upstream/master' into rustup
Diffstat (limited to 'src/docs/mutex_atomic.txt')
| -rw-r--r-- | src/docs/mutex_atomic.txt | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/docs/mutex_atomic.txt b/src/docs/mutex_atomic.txt deleted file mode 100644 index 062ac8b323b..00000000000 --- a/src/docs/mutex_atomic.txt +++ /dev/null @@ -1,22 +0,0 @@ -### What it does -Checks for usages of `Mutex<X>` where an atomic will do. - -### Why is this bad? -Using a mutex just to make access to a plain bool or -reference sequential is shooting flies with cannons. -`std::sync::atomic::AtomicBool` and `std::sync::atomic::AtomicPtr` are leaner and -faster. - -### Known problems -This lint cannot detect if the mutex is actually used -for waiting before a critical section. - -### Example -``` -let x = Mutex::new(&y); -``` - -Use instead: -``` -let x = AtomicBool::new(y); -``` \ No newline at end of file |
