diff --git a/NAMESPACE b/NAMESPACE index 753e18d53..0b706d5ae 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -29,7 +29,6 @@ importFrom(purrr,flatten_int) importFrom(purrr,map) importFrom(purrr,map2) importFrom(purrr,map2_chr) -importFrom(purrr,map2_lgl) importFrom(purrr,map_at) importFrom(purrr,map_chr) importFrom(purrr,map_int) diff --git a/R/nest.R b/R/nest.R index fb36b05c0..c1356a726 100644 --- a/R/nest.R +++ b/R/nest.R @@ -114,8 +114,7 @@ drop_cached_children <- function(pd) { pos_ids_to_keep <- pd_parent_first %>% split(cumsum(pd_parent_first$parent == 0)) %>% map(find_pos_id_to_keep) %>% - unlist() %>% - unname() + unlist(use.names = FALSE) pd[pd$pos_id %in% pos_ids_to_keep, ] } else { pd diff --git a/R/parse.R b/R/parse.R index 3651ce2a7..b6d628486 100644 --- a/R/parse.R +++ b/R/parse.R @@ -201,13 +201,15 @@ is_insufficiently_parsed_string <- function(pd) { is_insufficiently_parsed_number <- function(pd) { grepl("^0x", pd$text) & pd$token == "NUM_CONST" } -#' @importFrom purrr map2_lgl + +#' Check whether columns match +#' @keywords internal +#' @noRd lines_and_cols_match <- function(data) { left <- paste0(line_col_names(), "") right <- paste0(line_col_names(), "parent") - map2_lgl(left, right, - two_cols_match, - data = data - ) %>% - all() + identical( + unlist(data[left], use.names = FALSE), + unlist(data[right], use.names = FALSE) + ) } diff --git a/R/stylerignore.R b/R/stylerignore.R index 246f83002..b691949aa 100644 --- a/R/stylerignore.R +++ b/R/stylerignore.R @@ -27,7 +27,7 @@ env_add_stylerignore <- function(pd_flat) { pd_flat_temp$pos_id, cumsum(is_stylerignore_switchpoint) ) %>% map(~ rep(.x[1], length(.x))) %>% - unlist() + unlist(use.names = FALSE) pd_flat_temp$lag_newlines <- pd_flat_temp$lag_newlines pd_flat_temp$lag_spaces <- lag(pd_flat_temp$spaces, default = 0) is_terminal_to_ignore <- pd_flat_temp$terminal & pd_flat_temp$stylerignore diff --git a/R/transform-block.R b/R/transform-block.R index 6c9c06e73..8500b2633 100644 --- a/R/transform-block.R +++ b/R/transform-block.R @@ -49,7 +49,7 @@ parse_transform_serialize_r_block <- function(pd_nested, paste0(rep_char(" ", base_indention), pd_nested$text), ~ c(rep("", .x), .y) ) %>% - unlist() + unlist(use.names = FALSE) } c(rep("", start_line - 1), serialized_transformed_text) } diff --git a/R/transform-files.R b/R/transform-files.R index 633f82c4a..f17f46511 100644 --- a/R/transform-files.R +++ b/R/transform-files.R @@ -257,7 +257,7 @@ parse_transform_serialize_r <- function(text, ) } - text_out <- unlist(text_out) + text_out <- unlist(text_out, use.names = FALSE) verify_roundtrip( text, text_out, diff --git a/R/utils-cache.R b/R/utils-cache.R index 1988be014..d4b59e5b2 100644 --- a/R/utils-cache.R +++ b/R/utils-cache.R @@ -180,7 +180,7 @@ cache_write <- function(text, transformers, more_specs) { file.create() } -styler_version <- unlist(unname(read.dcf("DESCRIPTION")[, "Version"])) +styler_version <- unlist(unname(read.dcf("DESCRIPTION")[, "Version"]), use.names = FALSE) cache_get_name <- function() { getOption("styler.cache_name") diff --git a/R/utils-files.R b/R/utils-files.R index 1e5a16d70..974485549 100644 --- a/R/utils-files.R +++ b/R/utils-files.R @@ -53,7 +53,7 @@ map_filetype_to_pattern <- function(filetype) { #' setdiff("./file.R", "file.R") # you want to standardize first. dir_without_. <- function(path, recursive = TRUE, ...) { purrr::map(path, dir_without_._one, recursive = recursive, ...) %>% - unlist() + unlist(use.names = FALSE) } #' `dir()`, but with full names, ignored case, and included hidden files and diff --git a/R/utils.R b/R/utils.R index 14129e3f4..5b92535ba 100644 --- a/R/utils.R +++ b/R/utils.R @@ -36,16 +36,7 @@ convert_newlines_to_linebreaks <- function(text) { } else { .x }) %>% - unlist() -} - -#' Check whether two columns match -#' -#' @param col1,col2 Column names as string. -#' @param data The data frames that contains `col1` and `col2`. -#' @keywords internal -two_cols_match <- function(col1, col2, data) { - all(unlist(data[col1]) == unlist(data[col2])) + unlist(use.names = FALSE) } odd_index <- function(x) { diff --git a/man/two_cols_match.Rd b/man/two_cols_match.Rd deleted file mode 100644 index 565017840..000000000 --- a/man/two_cols_match.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{two_cols_match} -\alias{two_cols_match} -\title{Check whether two columns match} -\usage{ -two_cols_match(col1, col2, data) -} -\arguments{ -\item{col1, col2}{Column names as string.} - -\item{data}{The data frames that contains \code{col1} and \code{col2}.} -} -\description{ -Check whether two columns match -} -\keyword{internal}