@@ -256,26 +256,26 @@ impl Ordering {
256
256
///
257
257
/// use std::cmp::Ordering;
258
258
///
259
- /// let result = Ordering::Equal.or (Ordering::Less);
259
+ /// let result = Ordering::Equal.then (Ordering::Less);
260
260
/// assert_eq!(result, Ordering::Less);
261
261
///
262
- /// let result = Ordering::Less.or (Ordering::Equal);
262
+ /// let result = Ordering::Less.then (Ordering::Equal);
263
263
/// assert_eq!(result, Ordering::Less);
264
264
///
265
- /// let result = Ordering::Less.or (Ordering::Greater);
265
+ /// let result = Ordering::Less.then (Ordering::Greater);
266
266
/// assert_eq!(result, Ordering::Less);
267
267
///
268
- /// let result = Ordering::Equal.or (Ordering::Equal);
268
+ /// let result = Ordering::Equal.then (Ordering::Equal);
269
269
/// assert_eq!(result, Ordering::Equal);
270
270
///
271
271
/// let x: (i64, i64, i64) = (1, 2, 7);
272
272
/// let y: (i64, i64, i64) = (1, 5, 3);
273
- /// let result = x.0.cmp(&y.0).or (x.1.cmp(&y.1)).or (x.2.cmp(&y.2));
273
+ /// let result = x.0.cmp(&y.0).then (x.1.cmp(&y.1)).then (x.2.cmp(&y.2));
274
274
///
275
275
/// assert_eq!(result, Ordering::Less);
276
276
/// ```
277
277
#[ unstable( feature = "ordering_chaining" , issue = "37053" ) ]
278
- pub fn or ( self , other : Ordering ) -> Ordering {
278
+ pub fn then ( self , other : Ordering ) -> Ordering {
279
279
match self {
280
280
Equal => other,
281
281
_ => self ,
@@ -294,26 +294,26 @@ impl Ordering {
294
294
///
295
295
/// use std::cmp::Ordering;
296
296
///
297
- /// let result = Ordering::Equal.or_else (|| Ordering::Less);
297
+ /// let result = Ordering::Equal.then_with (|| Ordering::Less);
298
298
/// assert_eq!(result, Ordering::Less);
299
299
///
300
- /// let result = Ordering::Less.or_else (|| Ordering::Equal);
300
+ /// let result = Ordering::Less.then_with (|| Ordering::Equal);
301
301
/// assert_eq!(result, Ordering::Less);
302
302
///
303
- /// let result = Ordering::Less.or_else (|| Ordering::Greater);
303
+ /// let result = Ordering::Less.then_with (|| Ordering::Greater);
304
304
/// assert_eq!(result, Ordering::Less);
305
305
///
306
- /// let result = Ordering::Equal.or_else (|| Ordering::Equal);
306
+ /// let result = Ordering::Equal.then_with (|| Ordering::Equal);
307
307
/// assert_eq!(result, Ordering::Equal);
308
308
///
309
309
/// let x: (i64, i64, i64) = (1, 2, 7);
310
310
/// let y: (i64, i64, i64) = (1, 5, 3);
311
- /// let result = x.0.cmp(&y.0).or_else (|| x.1.cmp(&y.1)).or_else (|| x.2.cmp(&y.2));
311
+ /// let result = x.0.cmp(&y.0).then_with (|| x.1.cmp(&y.1)).then_with (|| x.2.cmp(&y.2));
312
312
///
313
313
/// assert_eq!(result, Ordering::Less);
314
314
/// ```
315
315
#[ unstable( feature = "ordering_chaining" , issue = "37053" ) ]
316
- pub fn or_else < F : FnOnce ( ) -> Ordering > ( self , f : F ) -> Ordering {
316
+ pub fn then_with < F : FnOnce ( ) -> Ordering > ( self , f : F ) -> Ordering {
317
317
match self {
318
318
Equal => f ( ) ,
319
319
_ => self ,
0 commit comments