diff --git a/R/indent.R b/R/indent.R index 4b5087d34..805a2f943 100644 --- a/R/indent.R +++ b/R/indent.R @@ -34,8 +34,6 @@ indent_without_paren_for_while_fun <- function(pd, indent_by) { indent_without_paren_if_else <- function(pd, indent_by) { expr_after_if <- next_non_comment(pd, which(pd$token == "')'")[1]) is_if <- pd$token[1] %in% "IF" - has_if_without_curly <- - is_if && pd$child[[expr_after_if]]$token[1] != "'{'" if (!is_if) { return(pd) } @@ -47,8 +45,6 @@ indent_without_paren_if_else <- function(pd, indent_by) { pd$indent[expr_after_if] <- indent_by } - - else_idx <- which(pd$token == "ELSE") if (length(else_idx) == 0L) { return(pd) diff --git a/R/reindent.R b/R/reindent.R index 5efd0bf17..28a2735e4 100644 --- a/R/reindent.R +++ b/R/reindent.R @@ -30,9 +30,8 @@ apply_ref_indention <- function(flattened_pd) { #' @keywords internal apply_ref_indention_one <- function(flattened_pd, target_token) { token_to_update <- find_tokens_to_update(flattened_pd, target_token) - # udate spaces + # update spaces copied_spaces <- flattened_pd$col2[target_token] - old_spaces <- flattened_pd$lag_spaces[token_to_update[1]] shift <- copied_spaces flattened_pd$lag_spaces[token_to_update] <- flattened_pd$lag_spaces[token_to_update] + shift diff --git a/R/rules-line-breaks.R b/R/rules-line-breaks.R index 31a8f5f7d..8193c0f0b 100644 --- a/R/rules-line-breaks.R +++ b/R/rules-line-breaks.R @@ -114,9 +114,6 @@ set_line_break_before_curly_opening <- function(pd) { next_non_comment, pd = pd ) - non_comment_after_expr <- non_comment_after_comma[ - non_comment_after_comma > should_not_be_on_same_line_idx[1] - ] pd$lag_newlines[non_comment_after_comma] <- 1L } } @@ -312,7 +309,6 @@ set_line_break_after_opening_if_call_is_multi_line <- function(pd, } break_pos <- find_line_break_position_in_multiline_call(pd) idx_nested <- next_non_comment(pd, 2) - nested_call <- is_function_call(pd$child[[idx_nested]]) if (pd_is_multi_line(pd$child[[idx_nested]]) && sum(pd$lag_newlines) > 0L) { break_pos <- c(break_pos, idx_nested) } diff --git a/R/stylerignore.R b/R/stylerignore.R index b691949aa..7ac889d82 100644 --- a/R/stylerignore.R +++ b/R/stylerignore.R @@ -62,7 +62,6 @@ add_stylerignore <- function(pd_flat) { if (!env_current$any_stylerignore) { return(pd_flat) } - pd_flat_terminals <- pd_flat[pd_flat$terminal, ] pd_flat_lat_line1 <- lag(pd_flat$line2, default = 0) on_same_line <- pd_flat$line1 == pd_flat_lat_line1 cumsum_start <- cumsum(start_candidate & !on_same_line)