Skip to content

Commit 99e6261

Browse files
authored
Rollup merge of rust-lang#118307 - scottmcm:tuple-eq-simpler, r=joshtriplett
Remove an unneeded helper from the tuple library code Thanks to rust-lang#107022, this is just what `==` does, so we don't need the helper here anymore.
2 parents a418c46 + 44a8bf5 commit 99e6261

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

core/src/tuple.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,6 @@ macro_rules! maybe_tuple_doc {
154154
};
155155
}
156156

157-
#[inline]
158-
const fn ordering_is_some(c: Option<Ordering>, x: Ordering) -> bool {
159-
// FIXME: Just use `==` once that's const-stable on `Option`s.
160-
// This is mapping `None` to 2 and then doing the comparison afterwards
161-
// because it optimizes better (`None::<Ordering>` is represented as 2).
162-
x as i8
163-
== match c {
164-
Some(c) => c as i8,
165-
None => 2,
166-
}
167-
}
168-
169157
// Constructs an expression that performs a lexical ordering using method `$rel`.
170158
// The values are interleaved, so the macro invocation for
171159
// `(a1, a2, a3) < (b1, b2, b3)` would be `lexical_ord!(lt, opt_is_lt, a1, b1,
@@ -176,7 +164,7 @@ const fn ordering_is_some(c: Option<Ordering>, x: Ordering) -> bool {
176164
macro_rules! lexical_ord {
177165
($rel: ident, $ne_rel: ident, $a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => {{
178166
let c = PartialOrd::partial_cmp(&$a, &$b);
179-
if !ordering_is_some(c, Equal) { ordering_is_some(c, $ne_rel) }
167+
if c != Some(Equal) { c == Some($ne_rel) }
180168
else { lexical_ord!($rel, $ne_rel, $($rest_a, $rest_b),+) }
181169
}};
182170
($rel: ident, $ne_rel: ident, $a:expr, $b:expr) => {

0 commit comments

Comments
 (0)