Refactor parameter checking in Dict to use is_some_and for improved clarity

This commit is contained in:
Wesley Yang 2025-04-03 17:50:00 +08:00
parent cc9b69f13f
commit 463da08fba

View File

@ -282,7 +282,7 @@ impl Dict {
let mut is_dict = true;
// try to check the number of parameters, if not, use array form
let use_two_args = mapper.params().map_or(false, |params| params.len() >= 2);
let use_two_args = mapper.params().is_some_and(|params| params.len() >= 2);
for (key, value) in self {
// choose how to pass parameters based on the function signature