Update packages/controllers/src/hooks.rs
@@ -123,16 +123,16 @@ impl<'a> Hooks<'a> {
}
// Returns true is this_hook is in hooks; false otherwiseq
- pub fn query_this_hook<Q: CustomQuery>(&self, deps: Deps<Q>, this_hook: String) -> StdResult<bool> {
- let hooks = self.query_hooks(deps)?;
-
- for i in 0..hooks.hooks.len() {
- if hooks.hooks[i] == this_hook
- {
- return Ok(true);
- }
- }
- return Ok(false);
+ pub fn query_this_hook<Q: CustomQuery>(
+ &self,
+ deps: Deps<Q>,
+ this_hook: String,
+ ) -> StdResult<bool> {
+ Ok(self
+ .query_hooks(deps)?
+ .hooks
+ .into_iter()
+ .any(|hook| hook == this_hook))
}
}
