And map_or doesnāt satisfy this demand?
In my cursory inspection of the Rust stdlib I have yet to find a function that takes a single closure and puts a non-closure argument after the closure argument. I admit that I havenāt done an exhaustive search of the stdlib, but all of the functions I can think of off the top of my head that take closures put the closures last.
I donāt know what sort of evidence would satisfy you. The fact that map_or follows the closure-last convention seems like it should be sufficient to demonstrate that this closure-last convention is considered stronger than the subjective āI think the arguments should be in a different order based on the function nameā claim.
In general, when a function takes a closure argument, it goes last because that aids readability when using multi-line closures.
foo.bar(arg1, arg2, |x| {
baz();
quux();
});
is generally considered more readable than
foo.bar(|x| {
baz();
quux();
}, arg1, arg2);
Not only that, but because we already seem to have a strong convention of putting the closure last, following this convention everywhere means that users can rely on it and not screw up parameter order (e.g. in map_or they know the closure goes last, so the default value must go first).