]> git.lizzy.rs Git - rust.git/blobdiff - crates/limit/src/lib.rs
Use `compare_exchange_weak` in `limit::Limit::check`
[rust.git] / crates / limit / src / lib.rs
index ace7ef7239b2895d42c52ed0adc5182ddbf510d1..12228e105c1cc567d1c3d3d60c8bf1cafa880452 100644 (file)
@@ -45,7 +45,7 @@ pub fn check(&self, other: usize) -> Result<(), ()> {
                 }
                 if self
                     .max
-                    .compare_exchange(old_max, other, Ordering::Relaxed, Ordering::Relaxed)
+                    .compare_exchange_weak(old_max, other, Ordering::Relaxed, Ordering::Relaxed)
                     .is_ok()
                 {
                     eprintln!("new max: {}", other);