X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=library%2Fcore%2Fsrc%2Fcmp.rs;h=b75ae996e4853b46219e4495f4ae08f1d5168fb6;hb=5b6ed253c42a69b93e7447fb0874a89ab6bc1cfb;hp=a7d6fec7d3dc1354121ea6058cb766bedc7affbe;hpb=e0f6840bb663e68064cd4737e6dded2cc91f8fce;p=rust.git diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index a7d6fec7d3d..b75ae996e48 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -798,16 +798,7 @@ fn max(self, other: Self) -> Self Self: Sized, Self: ~const Destruct, { - #[cfg(not(bootstrap))] - { - max_by(self, other, Ord::cmp) - } - - #[cfg(bootstrap)] - match self.cmp(&other) { - Ordering::Less | Ordering::Equal => other, - Ordering::Greater => self, - } + max_by(self, other, Ord::cmp) } /// Compares and returns the minimum of two values. @@ -828,16 +819,7 @@ fn min(self, other: Self) -> Self Self: Sized, Self: ~const Destruct, { - #[cfg(not(bootstrap))] - { - min_by(self, other, Ord::cmp) - } - - #[cfg(bootstrap)] - match self.cmp(&other) { - Ordering::Less | Ordering::Equal => self, - Ordering::Greater => other, - } + min_by(self, other, Ord::cmp) } /// Restrict a value to a certain interval. @@ -1234,23 +1216,7 @@ pub const fn min_by_key K, K: ~const Ord>(v1: T, v2: T F: ~const Destruct, K: ~const Destruct, { - cfg_if! { - if #[cfg(bootstrap)] { - const fn imp K, K: ~const Ord>( - f: &mut F, - (v1, v2): (&T, &T), - ) -> Ordering - where - T: ~const Destruct, - K: ~const Destruct, - { - f(v1).cmp(&f(v2)) - } - min_by(v1, v2, ConstFnMutClosure::new(&mut f, imp)) - } else { - min_by(v1, v2, const |v1, v2| f(v1).cmp(&f(v2))) - } - } + min_by(v1, v2, const |v1, v2| f(v1).cmp(&f(v2))) } /// Compares and returns the maximum of two values.