From ea76d137fdeb90174a8e45622937673b35736753 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 1 Oct 2024 16:17:59 -0700 Subject: [PATCH] sort_by_key --- src/rbx.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rbx.rs b/src/rbx.rs index 76e5861..46b5476 100644 --- a/src/rbx.rs +++ b/src/rbx.rs @@ -63,7 +63,7 @@ impl ModesBuilder{ //collect modes and stages into contiguous arrays let mut unique_modes:Vec<(gameplay_modes::ModeId,gameplay_modes::Mode)> =self.modes.into_iter().collect(); - unique_modes.sort_by(|a,b|a.0.cmp(&b.0)); + unique_modes.sort_by_key(|&(mode_id,_)|mode_id); let (mut modes,final_mode_id_from_builder_mode_id):(Vec,HashMap) =unique_modes.into_iter().enumerate() .map(|(final_mode_id,(builder_mode_id,mut mode))|{