Skip to content

Commit

Permalink
avoid structure() (#2227)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Oct 4, 2023
1 parent 9c49c6e commit 8d420b5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
}

flatten_lints <- function(x) {
structure(
flatten_list(x, class = "lint"),
class = "lints"
)
x <- flatten_list(x, class = "lint")
class(x) <- "lints"
x
}

# any function using unlist or c was dropping the classnames,
Expand Down Expand Up @@ -169,7 +168,9 @@ Linter <- function(fun, name = linter_auto_name()) { # nolint: object_name.
stop("`fun` must be a function taking exactly one argument.", call. = FALSE)
}
force(name)
structure(fun, class = c("linter", "function"), name = name)
class(fun) <- c("linter", "function")
attr(fun, "name") <- name
fun
}

read_lines <- function(file, encoding = settings$encoding, ...) {
Expand Down

0 comments on commit 8d420b5

Please sign in to comment.