This makes it a bit slower than it needs to be if is_function(x) is already true, where it could just return immediately.
An easy fix would be to put that early return for if (is_function()) before the local_error_call() call, but I'm wondering if the local-error-call thing is really necessary?
Right now it is materialized at every call due to
local_error_call()
https://github.com/r-lib/rlang/blob/33db700d556b0b85a1fe78e14a53f95ac9248004/R/fn.R#L389-L393
This makes it a bit slower than it needs to be if
is_function(x)
is already true, where it could just return immediately.An easy fix would be to put that early return for
if (is_function())
before thelocal_error_call()
call, but I'm wondering if the local-error-call thing is really necessary?