Skip to content

Commit 44a8bf5

Browse files
committed
Remove an unneeded helper from the tuple library code
1 parent 250aa17 commit 44a8bf5

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
@@ -161,18 +161,6 @@ macro_rules! maybe_tuple_doc {
161161
};
162162
}
163163

164-
#[inline]
165-
const fn ordering_is_some(c: Option<Ordering>, x: Ordering) -> bool {
166-
// FIXME: Just use `==` once that's const-stable on `Option`s.
167-
// This is mapping `None` to 2 and then doing the comparison afterwards
168-
// because it optimizes better (`None::<Ordering>` is represented as 2).
169-
x as i8
170-
== match c {
171-
Some(c) => c as i8,
172-
None => 2,
173-
}
174-
}
175-
176164
// Constructs an expression that performs a lexical ordering using method `$rel`.
177165
// The values are interleaved, so the macro invocation for
178166
// `(a1, a2, a3) < (b1, b2, b3)` would be `lexical_ord!(lt, opt_is_lt, a1, b1,
@@ -183,7 +171,7 @@ const fn ordering_is_some(c: Option<Ordering>, x: Ordering) -> bool {
183171
macro_rules! lexical_ord {
184172
($rel: ident, $ne_rel: ident, $a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => {{
185173
let c = PartialOrd::partial_cmp(&$a, &$b);
186-
if !ordering_is_some(c, Equal) { ordering_is_some(c, $ne_rel) }
174+
if c != Some(Equal) { c == Some($ne_rel) }
187175
else { lexical_ord!($rel, $ne_rel, $($rest_a, $rest_b),+) }
188176
}};
189177
($rel: ident, $ne_rel: ident, $a:expr, $b:expr) => {

0 commit comments

Comments
 (0)