FIX: Make clippy happy
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
61cecb7af5
commit
3191e12b93
@@ -246,7 +246,7 @@ impl Model {
|
|||||||
}
|
}
|
||||||
// None of the cases matched so we return the default
|
// None of the cases matched so we return the default
|
||||||
// If there is an even number of args is the last one otherwise is #N/A
|
// If there is an even number of args is the last one otherwise is #N/A
|
||||||
if args_count % 2 == 0 {
|
if args_count.is_multiple_of(2) {
|
||||||
return self.evaluate_node_in_context(&args[args_count - 1], cell);
|
return self.evaluate_node_in_context(&args[args_count - 1], cell);
|
||||||
}
|
}
|
||||||
CalcResult::Error {
|
CalcResult::Error {
|
||||||
@@ -262,7 +262,7 @@ impl Model {
|
|||||||
if args_count < 2 {
|
if args_count < 2 {
|
||||||
return CalcResult::new_args_number_error(cell);
|
return CalcResult::new_args_number_error(cell);
|
||||||
}
|
}
|
||||||
if args_count % 2 != 0 {
|
if !args_count.is_multiple_of(2) {
|
||||||
// Missing value for last condition
|
// Missing value for last condition
|
||||||
return CalcResult::new_args_number_error(cell);
|
return CalcResult::new_args_number_error(cell);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ impl Model {
|
|||||||
// FIXME: This function shares a lot of code with apply_ifs. Can we merge them?
|
// FIXME: This function shares a lot of code with apply_ifs. Can we merge them?
|
||||||
pub(crate) fn fn_countifs(&mut self, args: &[Node], cell: CellReferenceIndex) -> CalcResult {
|
pub(crate) fn fn_countifs(&mut self, args: &[Node], cell: CellReferenceIndex) -> CalcResult {
|
||||||
let args_count = args.len();
|
let args_count = args.len();
|
||||||
if args_count < 2 || args_count % 2 == 1 {
|
if args_count < 2 || !args_count.is_multiple_of(2) {
|
||||||
return CalcResult::new_args_number_error(cell);
|
return CalcResult::new_args_number_error(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,7 +476,7 @@ impl Model {
|
|||||||
F: FnMut(f64),
|
F: FnMut(f64),
|
||||||
{
|
{
|
||||||
let args_count = args.len();
|
let args_count = args.len();
|
||||||
if args_count < 3 || args_count % 2 == 0 {
|
if args_count < 3 || args_count.is_multiple_of(2) {
|
||||||
return Err(CalcResult::new_args_number_error(cell));
|
return Err(CalcResult::new_args_number_error(cell));
|
||||||
}
|
}
|
||||||
let arg_0 = self.evaluate_node_in_context(&args[0], cell);
|
let arg_0 = self.evaluate_node_in_context(&args[0], cell);
|
||||||
|
|||||||
Reference in New Issue
Block a user