I've quickly checked the code and I think it's OK the way it is: it's called from a template function with both parameters being of the same type and I don't think they'll be always double:
log_inv_logit_diff(c(y-2) - lambda, c(y-1) - lambda)