From 14d3e6b1467960af6965a67a0fef987f5288be6c Mon Sep 17 00:00:00 2001 From: Lucy Date: Sun, 14 Apr 2024 16:00:52 -0400 Subject: [PATCH] sort: truncate just to be safe... --- crates/sort/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/sort/src/lib.rs b/crates/sort/src/lib.rs index 150b969..9ca08b8 100644 --- a/crates/sort/src/lib.rs +++ b/crates/sort/src/lib.rs @@ -7,6 +7,7 @@ use std::cmp::Ordering; #[byond_fn] pub fn sort(mut list: Vec, proc_name: String) -> Vec { + let original_len = list.len(); glidesort::sort_in_vec_by(&mut list, |a, b| { match meowtonin::call_global::<_, _, _, Option>(&proc_name, [a, b]) .expect("sort proc failed") @@ -15,5 +16,6 @@ pub fn sort(mut list: Vec, proc_name: String) -> Vec { None => Ordering::Equal, } }); + list.truncate(original_len); list }