Fix error.
This commit is contained in:
parent
4fe80a2026
commit
c58fe87107
@ -1468,10 +1468,9 @@ pub mod array_functions {
|
|||||||
///
|
///
|
||||||
/// print(x); // prints "[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]"
|
/// print(x); // prints "[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]"
|
||||||
/// ```
|
/// ```
|
||||||
#[rhai_fn(return_raw)]
|
pub fn sort(ctx: NativeCallContext, array: &mut Array, comparer: FnPtr) {
|
||||||
pub fn sort(ctx: NativeCallContext, array: &mut Array, comparer: FnPtr) -> RhaiResultOf<()> {
|
|
||||||
if array.len() <= 1 {
|
if array.len() <= 1 {
|
||||||
return Ok(());
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
array.sort_by(|x, y| {
|
array.sort_by(|x, y| {
|
||||||
@ -1489,8 +1488,6 @@ pub mod array_functions {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
/// Sort the array.
|
/// Sort the array.
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user