diff --git a/crates/components/src/id_vec.rs b/crates/components/src/id_vec.rs index b43b7e80..db564be9 100644 --- a/crates/components/src/id_vec.rs +++ b/crates/components/src/id_vec.rs @@ -152,7 +152,7 @@ where F: Fn(usize) -> String, { fn ui(self, ui: &mut egui::Ui) -> egui::Response { - if self.search_needs_update && !self.reference.is_sorted() { + if self.search_needs_update && luminol_core::slice_is_sorted(self.reference) { self.reference.sort_unstable(); } @@ -304,10 +304,10 @@ where { fn ui(self, ui: &mut egui::Ui) -> egui::Response { if self.search_needs_update { - if !self.plus.is_sorted() { + if !luminol_core::slice_is_sorted(self.plus) { self.plus.sort_unstable(); } - if !self.minus.is_sorted() { + if !luminol_core::slice_is_sorted(self.minus) { self.minus.sort_unstable(); } } diff --git a/crates/components/src/lib.rs b/crates/components/src/lib.rs index d9890e4b..02a6384b 100644 --- a/crates/components/src/lib.rs +++ b/crates/components/src/lib.rs @@ -22,7 +22,6 @@ // terms of the Steamworks API by Valve Corporation, the licensors of this // Program grant you additional permission to convey the resulting work. #![cfg_attr(target_arch = "wasm32", allow(clippy::arc_with_non_send_sync))] -#![feature(is_sorted)] use itertools::Itertools; diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index d29e5b92..0ee87f6f 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -436,3 +436,10 @@ impl<'res> UpdateState<'res> { self.modified.set(false); } } + +pub fn slice_is_sorted<T: Ord>(s: &[T]) -> bool { + s.windows(2).all(|w| { + let [a, b] = w else { unreachable!() }; // could maybe do unreachable_unchecked + a <= b + }) +} diff --git a/crates/data/src/lib.rs b/crates/data/src/lib.rs index a9712116..408da518 100644 --- a/crates/data/src/lib.rs +++ b/crates/data/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(min_specialization)] #![allow(non_upper_case_globals)] // Editor specific types diff --git a/crates/ui/src/lib.rs b/crates/ui/src/lib.rs index b53958b9..7f5cdcf2 100644 --- a/crates/ui/src/lib.rs +++ b/crates/ui/src/lib.rs @@ -21,7 +21,6 @@ // it with Steamworks API by Valve Corporation, containing parts covered by // terms of the Steamworks API by Valve Corporation, the licensors of this // Program grant you additional permission to convey the resulting work. -#![feature(is_sorted)] pub type UpdateState<'res> = luminol_core::UpdateState<'res>; diff --git a/crates/ui/src/windows/actors.rs b/crates/ui/src/windows/actors.rs index f3ba35c2..dbe35e03 100644 --- a/crates/ui/src/windows/actors.rs +++ b/crates/ui/src/windows/actors.rs @@ -277,10 +277,10 @@ impl luminol_core::Window for Window { }); if let Some(class) = classes.data.get_mut(actor.class_id) { - if !class.weapon_set.is_sorted() { + if !luminol_core::slice_is_sorted(&class.weapon_set) { class.weapon_set.sort_unstable(); } - if !class.armor_set.is_sorted() { + if !luminol_core::slice_is_sorted(&class.armor_set) { class.armor_set.sort_unstable(); } }