Skip to content

Commit 6d2b327

Browse files
Avoid paste0 overhead in is_lint_level (#2360)
* avoid paste0 overhead * use switch() for further micro-optimization --------- Co-authored-by: AshesITR <alexander.rosenstock@web.de>
1 parent f6453b6 commit 6d2b327

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

R/is_lint_level.R

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
#'
2020
#' @export
2121
is_lint_level <- function(source_expression, level = c("expression", "file")) {
22-
stopifnot(!missing(level))
2322
level <- match.arg(level)
24-
required_key <- paste0(if (level == "file") "full_", "parsed_content")
23+
required_key <- switch(level, file = "full_parsed_content", expression = "parsed_content")
2524
required_key %in% names(source_expression)
2625
}
2726

0 commit comments

Comments
 (0)