Skip to content

Commit 82fd36f

Browse files
committed
Drive-by cleanup: use .is_sorted() instead of implementing it by hand
1 parent 6d67b09 commit 82fd36f

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

compiler/rustc_middle/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#![feature(result_option_inspect)]
6161
#![feature(const_option)]
6262
#![feature(trait_alias)]
63+
#![feature(is_sorted)]
6364
#![recursion_limit = "512"]
6465
#![allow(rustc::potential_query_instability)]
6566

compiler/rustc_middle/src/ty/context/mk.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![allow(rustc::usage_of_ty_tykind)]
22

3-
use std::cmp::Ordering;
43
use std::iter;
54

65
use rustc_error_messages::MultiSpan;
@@ -547,9 +546,7 @@ impl<'tcx> MkCtxt<'tcx> {
547546
) -> &'tcx List<PolyExistentialPredicate<'tcx>> {
548547
assert!(!eps.is_empty());
549548
assert!(
550-
eps.array_windows()
551-
.all(|[a, b]| a.skip_binder().stable_cmp(self.tcx, &b.skip_binder())
552-
!= Ordering::Greater)
549+
eps.is_sorted_by(|a, b| Some(a.skip_binder().stable_cmp(self.tcx, &b.skip_binder())))
553550
);
554551
self.tcx.intern_poly_existential_predicates(eps)
555552
}

0 commit comments

Comments
 (0)