Why is iterator parameter for method "all" "f" and not "predicate"

why this?

fn all(&mut self, f: F) -> bool

and not this?

fn all(&mut self, predicate: F) -> bool

since f returns a boolean FnMut(Self::Item) -> bool,

the filter method also takes FnMut(&Self::Item) -> bool but calls its parameter "predicate"

1 Like

I think it's just because that was the name the author decided to use. The names for parameters are mostly cosmetic, and what the function passed to all() does is obvious from context, so I doubt they put much effort into it.

It might be useful to point out that other iterator methods like map(), for_each(), and fold() use f as the name for the closure being passed in even though map, action, and accumulator could have been more accurate names.