R/unused.R

Defines functions check_unused

Documented in check_unused

#' Check Unused
#' 
#' Checks whether ... is unused. It can only be used in functions.
#' 
#' @inheritParams params
#' @param ... The arguments to check.
#' @return An invisible copy of x (if it doesn't throw an error).
#' @export
#' @examples
#' fun <- function(...) check_unused(..., error = FALSE)
#' fun()
#' fun(1)
check_unused <- function(..., x_name = "...", error = TRUE) {
  lifecycle::deprecate_soft("0.5.1", "check_unused()", "chk::chk_unused()")
  check_string_internal(x_name)
  if(length(list(...)))
    chk_fail(x_name, " must be unused", error = error)
  invisible(...)
}
poissonconsulting/checkr documentation built on Oct. 18, 2023, 9:39 p.m.