Skip to content

Commit 5413eb2

Browse files
improve for speed (and legibility)
1 parent 51261bb commit 5413eb2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

R/rules-other.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ wrap_subexpr_in_curly <- function(pd,
8484
ind_to_be_wrapped,
8585
indent_by) {
8686
to_be_wrapped_starts_with_comment <-
87-
pd[ind_to_be_wrapped[1], ]$token == "COMMENT"
87+
pd$token[ind_to_be_wrapped[1]] == "COMMENT"
8888
new_expr <- wrap_expr_in_curly(
8989
pd[ind_to_be_wrapped, ],
9090
stretch_out = c(!to_be_wrapped_starts_with_comment, TRUE)

R/utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ next_non_comment <- function(pd, pos) {
6767
#' @param pos The position of the token to start the search from.
6868
extend_if_comment <- function(pd, pos) {
6969
if (pos == nrow(pd)) return(pos)
70-
if (pd[pos + 1,]$token == "COMMENT") {
70+
if (pd$token[pos + 1] == "COMMENT") {
7171
extend_if_comment(pd, pos + 1L)
7272
} else {
7373
pos

0 commit comments

Comments
 (0)