Replace find and is_some with any
Calling `is_some()` after searching an `Iterator` with find is more
succinctly expressed by calling `any()`.
@@ -115,11 +115,7 @@ impl<'a> PermissionChecker<'a> {
) -> Result<bool, PermissionCheckerError> {
let agent = self.get_agent(public_key)?;
match agent {
- Some(agent) => Ok(agent
- .roles()
- .into_iter()
- .find(|&r| r == permission)
- .is_some()),
+ Some(agent) => Ok(agent.roles().into_iter().any(|r| r == permission)),
None => Err(PermissionCheckerError::InvalidPublicKey(format!(
"The signer is not an Agent: {}",
public_key
