Skip to content

Commit 7371bac

Browse files
authored
Format with Air 0.7.0 (r-lib#1805)
1 parent 9b70d4e commit 7371bac

File tree

4 files changed

+26
-27
lines changed

4 files changed

+26
-27
lines changed

R/types.R

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ is_list <- function(x, n = NULL) {
3232
.Call(ffi_is_list, x, n)
3333
}
3434

35-
parsable_atomic_types <- c("logical", "integer", "double", "complex", "character")
35+
parsable_atomic_types <- c(
36+
"logical",
37+
"integer",
38+
"double",
39+
"complex",
40+
"character"
41+
)
3642
atomic_types <- c(parsable_atomic_types, "raw")
3743
#' @export
3844
#' @rdname type-predicates
@@ -70,11 +76,7 @@ is_complex <- function(x, n = NULL, finite = NULL) {
7076
is_character <- function(x, n = NULL) {
7177
.Call(ffi_is_character, x, n, NULL, NULL)
7278
}
73-
is_character2 <- function(x,
74-
n = NULL,
75-
...,
76-
missing = TRUE,
77-
empty = TRUE) {
79+
is_character2 <- function(x, n = NULL, ..., missing = TRUE, empty = TRUE) {
7880
check_dots_empty0(...)
7981

8082
# FIXME: Change API at C-level so that `TRUE` means no restriction
@@ -241,7 +243,9 @@ is_bare_integer <- function(x, n = NULL) {
241243
#' @export
242244
#' @rdname bare-type-predicates
243245
is_bare_numeric <- function(x, n = NULL) {
244-
if (!is_null(n) && length(x) != n) return(FALSE)
246+
if (!is_null(n) && length(x) != n) {
247+
return(FALSE)
248+
}
245249
!is.object(x) && typeof(x) %in% c("double", "integer")
246250
}
247251
#' @export
@@ -402,15 +406,15 @@ type_of_ <- function(x) {
402406
#' # copyable:
403407
#' is_copyable(env)
404408
is_copyable <- function(x) {
405-
switch(typeof(x),
409+
switch(
410+
typeof(x),
406411
NULL = ,
407412
char = ,
408413
symbol = ,
409414
special = ,
410415
builtin = ,
411416
environment = ,
412-
externalptr =
413-
FALSE,
417+
externalptr = FALSE,
414418
TRUE
415419
)
416420
}
@@ -491,7 +495,8 @@ rlang_type_sum.data.frame <- function(x) class(x)[[1]]
491495
#' @export
492496
rlang_type_sum.default <- function(x) {
493497
if (!is.object(x)) {
494-
switch(typeof(x),
498+
switch(
499+
typeof(x),
495500
logical = "lgl",
496501
integer = "int",
497502
double = "dbl",
@@ -501,12 +506,11 @@ rlang_type_sum.default <- function(x) {
501506
special = ,
502507
closure = "fn",
503508
environment = "env",
504-
symbol =
505-
if (is_missing(x)) {
506-
"missing"
507-
} else {
508-
"sym"
509-
},
509+
symbol = if (is_missing(x)) {
510+
"missing"
511+
} else {
512+
"sym"
513+
},
510514
typeof(x)
511515
)
512516
} else if (!isS4(x)) {

tests/testthat/test-call.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,7 @@ test_that("call_name() handles formulas", {
355355

356356
test_that("Inlined functions return NULL name", {
357357
call <- quote(fn())
358-
call[[1]] <- function() {
359-
}
358+
call[[1]] <- function() {}
360359
expect_null(call_name(call))
361360
})
362361

tests/testthat/test-deparse.R

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -689,25 +689,22 @@ test_that("symbols with unicode are deparsed consistently (#691)", {
689689

690690
test_that("formal parameters are backticked if needed", {
691691
expect_identical(
692-
expr_deparse(function(`^`) {
693-
}),
692+
expr_deparse(function(`^`) {}),
694693
c("<function(`^`) { }>")
695694
)
696695
})
697696

698697
test_that("empty blocks are deparsed on the same line", {
699698
expect_identical(
700-
expr_deparse(quote({
701-
})),
699+
expr_deparse(quote({})),
702700
"{ }"
703701
)
704702
})
705703

706704
test_that("top-level S3 objects are deparsed", {
707705
skip_on_cran()
708706
f <- structure(
709-
function() {
710-
},
707+
function() {},
711708
class = "lambda"
712709
)
713710
expect_identical(expr_deparse(f), "<lambda>")

tests/testthat/test-types.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ test_that("scalar predicates heed type and length", {
101101
expect_true_false(is_scalar_list, list(1), list(1, 2), logical(1))
102102
expect_true_false(is_scalar_atomic, logical(1), logical(2), list(1))
103103
expect_true_false(is_scalar_vector, list(1), list(1, 2), quote(x))
104-
expect_true_false(is_scalar_vector, logical(1), logical(2), function() {
105-
})
104+
expect_true_false(is_scalar_vector, logical(1), logical(2), function() {})
106105
expect_true_false(is_scalar_integer, integer(1), integer(2), double(1))
107106
expect_true_false(is_scalar_double, double(1), double(2), integer(1))
108107
expect_true_false(is_scalar_character, character(1), character(2), logical(1))

0 commit comments

Comments
 (0)