Skip to content

Commit 5647078

Browse files
authored
Rollup merge of #62942 - KevinWMatthews:condvar_docs_match_ergo, r=sfackler
Use match ergonomics in Condvar documentation Documentation was written before match ergonomics was merged. See #62857. In short, replaces ```rust let &(ref lock, ref cvar) = &*pair; ``` with ```rust let (lock, cvar) = &*pair ``` in the docs of `std::sync::Condvar`.
2 parents 17fd31b + c091818 commit 5647078

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/libstd/sync/condvar.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl WaitTimeoutResult {
3636
/// let pair2 = pair.clone();
3737
///
3838
/// thread::spawn(move|| {
39-
/// let &(ref lock, ref cvar) = &*pair2;
39+
/// let (lock, cvar) = &*pair2;
4040
///
4141
/// // Let's wait 20 milliseconds before notifying the condvar.
4242
/// thread::sleep(Duration::from_millis(20));
@@ -48,7 +48,7 @@ impl WaitTimeoutResult {
4848
/// });
4949
///
5050
/// // Wait for the thread to start up.
51-
/// let &(ref lock, ref cvar) = &*pair;
51+
/// let (lock, cvar) = &*pair;
5252
/// let mut started = lock.lock().unwrap();
5353
/// loop {
5454
/// // Let's put a timeout on the condvar's wait.
@@ -94,15 +94,15 @@ impl WaitTimeoutResult {
9494
///
9595
/// // Inside of our lock, spawn a new thread, and then wait for it to start.
9696
/// thread::spawn(move|| {
97-
/// let &(ref lock, ref cvar) = &*pair2;
97+
/// let (lock, cvar) = &*pair2;
9898
/// let mut started = lock.lock().unwrap();
9999
/// *started = true;
100100
/// // We notify the condvar that the value has changed.
101101
/// cvar.notify_one();
102102
/// });
103103
///
104104
/// // Wait for the thread to start up.
105-
/// let &(ref lock, ref cvar) = &*pair;
105+
/// let (lock, cvar) = &*pair;
106106
/// let mut started = lock.lock().unwrap();
107107
/// while !*started {
108108
/// started = cvar.wait(started).unwrap();
@@ -180,15 +180,15 @@ impl Condvar {
180180
/// let pair2 = pair.clone();
181181
///
182182
/// thread::spawn(move|| {
183-
/// let &(ref lock, ref cvar) = &*pair2;
183+
/// let (lock, cvar) = &*pair2;
184184
/// let mut started = lock.lock().unwrap();
185185
/// *started = true;
186186
/// // We notify the condvar that the value has changed.
187187
/// cvar.notify_one();
188188
/// });
189189
///
190190
/// // Wait for the thread to start up.
191-
/// let &(ref lock, ref cvar) = &*pair;
191+
/// let (lock, cvar) = &*pair;
192192
/// let mut started = lock.lock().unwrap();
193193
/// // As long as the value inside the `Mutex<bool>` is `false`, we wait.
194194
/// while !*started {
@@ -245,15 +245,15 @@ impl Condvar {
245245
/// let pair2 = pair.clone();
246246
///
247247
/// thread::spawn(move|| {
248-
/// let &(ref lock, ref cvar) = &*pair2;
248+
/// let (lock, cvar) = &*pair2;
249249
/// let mut started = lock.lock().unwrap();
250250
/// *started = true;
251251
/// // We notify the condvar that the value has changed.
252252
/// cvar.notify_one();
253253
/// });
254254
///
255255
/// // Wait for the thread to start up.
256-
/// let &(ref lock, ref cvar) = &*pair;
256+
/// let (lock, cvar) = &*pair;
257257
/// // As long as the value inside the `Mutex<bool>` is `false`, we wait.
258258
/// let _guard = cvar.wait_until(lock.lock().unwrap(), |started| { *started }).unwrap();
259259
/// ```
@@ -301,15 +301,15 @@ impl Condvar {
301301
/// let pair2 = pair.clone();
302302
///
303303
/// thread::spawn(move|| {
304-
/// let &(ref lock, ref cvar) = &*pair2;
304+
/// let (lock, cvar) = &*pair2;
305305
/// let mut started = lock.lock().unwrap();
306306
/// *started = true;
307307
/// // We notify the condvar that the value has changed.
308308
/// cvar.notify_one();
309309
/// });
310310
///
311311
/// // Wait for the thread to start up.
312-
/// let &(ref lock, ref cvar) = &*pair;
312+
/// let (lock, cvar) = &*pair;
313313
/// let mut started = lock.lock().unwrap();
314314
/// // As long as the value inside the `Mutex<bool>` is `false`, we wait.
315315
/// loop {
@@ -374,15 +374,15 @@ impl Condvar {
374374
/// let pair2 = pair.clone();
375375
///
376376
/// thread::spawn(move|| {
377-
/// let &(ref lock, ref cvar) = &*pair2;
377+
/// let (lock, cvar) = &*pair2;
378378
/// let mut started = lock.lock().unwrap();
379379
/// *started = true;
380380
/// // We notify the condvar that the value has changed.
381381
/// cvar.notify_one();
382382
/// });
383383
///
384384
/// // wait for the thread to start up
385-
/// let &(ref lock, ref cvar) = &*pair;
385+
/// let (lock, cvar) = &*pair;
386386
/// let mut started = lock.lock().unwrap();
387387
/// // as long as the value inside the `Mutex<bool>` is `false`, we wait
388388
/// loop {
@@ -449,15 +449,15 @@ impl Condvar {
449449
/// let pair2 = pair.clone();
450450
///
451451
/// thread::spawn(move|| {
452-
/// let &(ref lock, ref cvar) = &*pair2;
452+
/// let (lock, cvar) = &*pair2;
453453
/// let mut started = lock.lock().unwrap();
454454
/// *started = true;
455455
/// // We notify the condvar that the value has changed.
456456
/// cvar.notify_one();
457457
/// });
458458
///
459459
/// // wait for the thread to start up
460-
/// let &(ref lock, ref cvar) = &*pair;
460+
/// let (lock, cvar) = &*pair;
461461
/// let result = cvar.wait_timeout_until(
462462
/// lock.lock().unwrap(),
463463
/// Duration::from_millis(100),
@@ -508,15 +508,15 @@ impl Condvar {
508508
/// let pair2 = pair.clone();
509509
///
510510
/// thread::spawn(move|| {
511-
/// let &(ref lock, ref cvar) = &*pair2;
511+
/// let (lock, cvar) = &*pair2;
512512
/// let mut started = lock.lock().unwrap();
513513
/// *started = true;
514514
/// // We notify the condvar that the value has changed.
515515
/// cvar.notify_one();
516516
/// });
517517
///
518518
/// // Wait for the thread to start up.
519-
/// let &(ref lock, ref cvar) = &*pair;
519+
/// let (lock, cvar) = &*pair;
520520
/// let mut started = lock.lock().unwrap();
521521
/// // As long as the value inside the `Mutex<bool>` is `false`, we wait.
522522
/// while !*started {
@@ -548,15 +548,15 @@ impl Condvar {
548548
/// let pair2 = pair.clone();
549549
///
550550
/// thread::spawn(move|| {
551-
/// let &(ref lock, ref cvar) = &*pair2;
551+
/// let (lock, cvar) = &*pair2;
552552
/// let mut started = lock.lock().unwrap();
553553
/// *started = true;
554554
/// // We notify the condvar that the value has changed.
555555
/// cvar.notify_all();
556556
/// });
557557
///
558558
/// // Wait for the thread to start up.
559-
/// let &(ref lock, ref cvar) = &*pair;
559+
/// let (lock, cvar) = &*pair;
560560
/// let mut started = lock.lock().unwrap();
561561
/// // As long as the value inside the `Mutex<bool>` is `false`, we wait.
562562
/// while !*started {

0 commit comments

Comments
 (0)