Skip to content

Commit 3061e30

Browse files
replace loop with walk for speed
1 parent b3e32bb commit 3061e30

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ importFrom(purrr,map_lgl)
3535
importFrom(purrr,partial)
3636
importFrom(purrr,pmap)
3737
importFrom(purrr,pwalk)
38+
importFrom(purrr,walk)
3839
importFrom(purrr,when)
3940
importFrom(rlang,abort)
4041
importFrom(rlang,is_empty)

R/transform-files.R

+3-2
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,14 @@ parse_transform_serialize_r <- function(text,
257257
#' that trigger are required to be absent to trigger a removal.
258258
#' @param scope The low-level scope, e.g. 'token'.
259259
#' @param code tokenized code for which we check if `token` is in them.
260+
#' @importFrom purrr walk
260261
transformers_subset_impl <- function(transformers, token, scope, code) {
261262
transformer_names <- names(token)
262-
for (i in seq_along(token)) {
263+
walk(seq_along(token), function(i) {
263264
if (!any(token[[i]] %in% code)) {
264265
transformers[[scope]][[transformer_names[i]]] <- NULL
265266
}
266-
}
267+
})
267268
transformers
268269
}
269270

0 commit comments

Comments
 (0)