Why not make `expand_r_libs_specifiers` do nothing if version is `NULL`: then you could simplify this to `if (expand) version <- expand_r_libs_specifiers(version)`