Keep the nonempty-sample assertion in median

This commit is contained in:
David Peter committed 2026-10-05 14:02:52 +02:00
1 parent 8084a9eb7f
commit 0fe93f9d0b
1 file changed
+4
+4
View File
@@ -47,6 +47,10 @@ where
P: Into<Q>,
{
let mut values = values.into_iter().collect::<Vec<_>>();
assert!(
!values.is_empty(),
"median requires at least one measurement"
);
values.sort_by(|a, b| a.partial_cmp(b).expect("No NaN values"));
let len = values.len();