Skip to content

Commit

Permalink
remove annoying warnings
Browse files Browse the repository at this point in the history
like "package ‘xxx’ was built under R version x.x.x"
  • Loading branch information
DanChaltiel committed Jun 26, 2024
1 parent 24bec81 commit 163ad8c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ get_anywhere = function(fun, prefer=".GlobalEnv"){
#' @importFrom rlang ns_env
#' @noRd
register_namespace = function(name){
suppressPackageStartupMessages(loadNamespace(name))
suppressPackageStartupMessages(suppressWarnings(loadNamespace(name)))
TRUE
}

Expand All @@ -151,7 +151,9 @@ is_exported = function(fun, pkg, fail=FALSE){
if(fail) cli_abort("{.pkg {pkg}} is not installed")
return(FALSE)
}
l = withr::with_package(pkg, try(ls(paste0("package:",pkg)), silent=TRUE))


l = suppressWarnings(withr::with_package(pkg, try(ls(paste0("package:",pkg)), silent=TRUE), quietly=TRUE))
if(inherits(l, "try-error")) return(FALSE)
fun %in% l
}
Expand Down

0 comments on commit 163ad8c

Please sign in to comment.