Shut up clippy.
This commit is contained in:
@@ -1312,8 +1312,7 @@ pub mod array_functions {
|
||||
///
|
||||
/// print(x); // prints "[1, 2, 3, 4, 3, 2, 1]"
|
||||
/// ```
|
||||
#[rhai_fn(return_raw)]
|
||||
pub fn dedup(ctx: NativeCallContext, array: &mut Array) -> RhaiResultOf<()> {
|
||||
pub fn dedup(ctx: NativeCallContext, array: &mut Array) {
|
||||
let comparer = FnPtr::new_unchecked(OP_EQUALS, StaticVec::new_const());
|
||||
dedup_by_comparer(ctx, array, comparer)
|
||||
}
|
||||
@@ -1340,14 +1339,10 @@ pub mod array_functions {
|
||||
///
|
||||
/// print(x); // prints "[1, 2, 3, 4]"
|
||||
/// ```
|
||||
#[rhai_fn(name = "dedup", return_raw)]
|
||||
pub fn dedup_by_comparer(
|
||||
ctx: NativeCallContext,
|
||||
array: &mut Array,
|
||||
comparer: FnPtr,
|
||||
) -> RhaiResultOf<()> {
|
||||
#[rhai_fn(name = "dedup")]
|
||||
pub fn dedup_by_comparer(ctx: NativeCallContext, array: &mut Array, comparer: FnPtr) {
|
||||
if array.is_empty() {
|
||||
return Ok(());
|
||||
return;
|
||||
}
|
||||
|
||||
array.dedup_by(|x, y| {
|
||||
@@ -1357,8 +1352,6 @@ pub mod array_functions {
|
||||
.as_bool()
|
||||
.unwrap_or(false)
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
/// Remove duplicated _consecutive_ elements from the array that return `true` when applied a
|
||||
/// function named by `comparer`.
|
||||
@@ -1391,7 +1384,7 @@ pub mod array_functions {
|
||||
array: &mut Array,
|
||||
comparer: &str,
|
||||
) -> RhaiResultOf<()> {
|
||||
dedup_by_comparer(ctx, array, FnPtr::new(comparer)?)
|
||||
Ok(dedup_by_comparer(ctx, array, FnPtr::new(comparer)?))
|
||||
}
|
||||
/// Reduce an array by iterating through all elements while applying the `reducer` function.
|
||||
///
|
||||
|
Reference in New Issue
Block a user