diff --git a/NAMESPACE b/NAMESPACE index 847e35f5a6..1fcc0684d1 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -574,22 +574,9 @@ export(ylim) export(zeroGrob) import(grid) import(gtable) +import(rlang) import(scales) importFrom(lazyeval,f_eval) -importFrom(rlang,.data) -importFrom(rlang,enexpr) -importFrom(rlang,enexprs) -importFrom(rlang,enquo) -importFrom(rlang,enquos) -importFrom(rlang,ensym) -importFrom(rlang,ensyms) -importFrom(rlang,expr) -importFrom(rlang,exprs) -importFrom(rlang,quo) -importFrom(rlang,quo_name) -importFrom(rlang,quos) -importFrom(rlang,sym) -importFrom(rlang,syms) importFrom(stats,setNames) importFrom(tibble,tibble) importFrom(utils,.DollarNames) diff --git a/R/aes-calculated.r b/R/aes-calculated.r index ff93d8c86e..95b9390bba 100644 --- a/R/aes-calculated.r +++ b/R/aes-calculated.r @@ -93,10 +93,10 @@ make_labels <- function(mapping) { } mapping <- strip_dots(mapping) - if (rlang::is_quosure(mapping) && rlang::quo_is_symbol(mapping)) { - name <- rlang::as_string(rlang::quo_get_expr(mapping)) + if (is_quosure(mapping) && quo_is_symbol(mapping)) { + name <- as_string(quo_get_expr(mapping)) } else { - name <- rlang::quo_text(mapping) + name <- quo_text(mapping) name <- gsub("\n.*$", "...", name) } name diff --git a/R/aes.r b/R/aes.r index eb830da08b..d5a3996049 100644 --- a/R/aes.r +++ b/R/aes.r @@ -75,7 +75,7 @@ NULL #' cut3 <- function(x) cut_number(x, 3) #' scatter_by(mtcars, cut3(disp), drat) aes <- function(x, y, ...) { - exprs <- rlang::enquos(x = x, y = y, ..., .ignore_empty = "all") + exprs <- enquos(x = x, y = y, ..., .ignore_empty = "all") aes <- new_aes(exprs, env = parent.frame()) rename_aes(aes) } @@ -83,15 +83,15 @@ aes <- function(x, y, ...) { # Wrap symbolic objects in quosures but pull out constants out of # quosures for backward-compatibility new_aesthetic <- function(x, env = globalenv()) { - if (rlang::is_quosure(x)) { - if (!rlang::quo_is_symbolic(x)) { - x <- rlang::quo_get_expr(x) + if (is_quosure(x)) { + if (!quo_is_symbolic(x)) { + x <- quo_get_expr(x) } return(x) } - if (rlang::is_symbolic(x)) { - x <- rlang::new_quosure(x, env = env) + if (is_symbolic(x)) { + x <- new_quosure(x, env = env) return(x) } @@ -110,7 +110,7 @@ print.uneval <- function(x, ...) { if (length(x) == 0) { cat("\n") } else { - values <- vapply(x, rlang::quo_label, character(1)) + values <- vapply(x, quo_label, character(1)) bullets <- paste0("* ", format(paste0("`", names(x), "`")), " -> ", values, "\n") cat(bullets, sep = "") @@ -240,7 +240,7 @@ aes_ <- function(x, y, ...) { as_quosure_aes <- function(x) { if (is.formula(x) && length(x) == 2) { - rlang::as_quosure(x) + as_quosure(x) } else if (is.call(x) || is.name(x) || is.atomic(x)) { new_aesthetic(x, caller_env) } else { @@ -262,7 +262,7 @@ aes_string <- function(x, y, ...) { caller_env <- parent.frame() mapping <- lapply(mapping, function(x) { if (is.character(x)) { - x <- rlang::parse_expr(x) + x <- parse_expr(x) } new_aesthetic(x, env = caller_env) }) @@ -289,7 +289,7 @@ aes_all <- function(vars) { # Quosure the symbols in the empty environment because they can only # refer to the data mask structure( - lapply(vars, function(x) rlang::new_quosure(as.name(x), emptyenv())), + lapply(vars, function(x) new_quosure(as.name(x), emptyenv())), class = "uneval" ) } diff --git a/R/axis-secondary.R b/R/axis-secondary.R index 5ab8e1c4c2..87a6893dba 100644 --- a/R/axis-secondary.R +++ b/R/axis-secondary.R @@ -83,7 +83,7 @@ sec_axis <- function(trans = NULL, name = waiver(), breaks = waiver(), labels = # sec_axis() historically accpeted two-sided formula, so be permissive. if (length(trans) > 2) trans <- trans[c(1,3)] - trans <- rlang::as_function(trans) + trans <- as_function(trans) ggproto(NULL, AxisSecondary, trans = trans, name = name, diff --git a/R/bench.r b/R/bench.r index 42157229fd..60ab4ccb32 100644 --- a/R/bench.r +++ b/R/bench.r @@ -14,7 +14,7 @@ benchplot <- function(x) { x <- enquo(x) - construct <- system.time(x <- rlang::eval_tidy(x)) + construct <- system.time(x <- eval_tidy(x)) stopifnot(inherits(x, "ggplot")) build <- system.time(data <- ggplot_build(x)) diff --git a/R/facet-.r b/R/facet-.r index 4ccdcb3cd8..08ad219651 100644 --- a/R/facet-.r +++ b/R/facet-.r @@ -225,7 +225,7 @@ Facet <- ggproto("Facet", NULL, #' # Thanks to tidy eval idioms we now have another useful wrapper: #' p + wrap_cut(drat) vars <- function(...) { - rlang::quos(...) + quos(...) } @@ -278,8 +278,8 @@ as_facets_list <- function(x) { if (inherits(x, "uneval")) { stop("Please use `vars()` to supply facet variables", call. = FALSE) } - if (rlang::is_quosures(x)) { - x <- rlang::quos_auto_name(x) + if (is_quosures(x)) { + x <- quos_auto_name(x) return(list(x)) } @@ -287,20 +287,20 @@ as_facets_list <- function(x) { # facet_grid() directly converted strings to a formula while # facet_wrap() called as.quoted(). Hence this is a little more # complicated for backward compatibility. - if (rlang::is_string(x)) { - x <- rlang::parse_expr(x) + if (is_string(x)) { + x <- parse_expr(x) } # At this level formulas are coerced to lists of lists for backward # compatibility with facet_grid(). The LHS and RHS are treated as # distinct facet dimensions and `+` defines multiple facet variables # inside each dimension. - if (rlang::is_formula(x)) { + if (is_formula(x)) { return(f_as_facets_list(x)) } # For backward-compatibility with facet_wrap() - if (!rlang::is_bare_list(x)) { + if (!is_bare_list(x)) { x <- as_quoted(x) } @@ -316,9 +316,9 @@ as_facets_list <- function(x) { # Flatten a list of quosures objects to a quosures object, and compact it compact_facets <- function(x) { - x <- rlang::flatten_if(x, rlang::is_list) - null <- vapply(x, rlang::quo_is_null, logical(1)) - rlang::new_quosures(x[!null]) + x <- flatten_if(x, is_list) + null <- vapply(x, quo_is_null, logical(1)) + new_quosures(x[!null]) } # Compatibility with plyr::as.quoted() @@ -327,19 +327,19 @@ as_quoted <- function(x) { if (length(x) > 1) { x <- paste(x, collapse = "; ") } - return(rlang::parse_exprs(x)) + return(parse_exprs(x)) } if (is.null(x)) { return(list()) } - if (rlang::is_formula(x)) { + if (is_formula(x)) { return(simplify(x)) } list(x) } # From plyr:::as.quoted.formula simplify <- function(x) { - if (length(x) == 2 && rlang::is_symbol(x[[1]], "~")) { + if (length(x) == 2 && is_symbol(x[[1]], "~")) { return(simplify(x[[2]])) } if (length(x) < 3) { @@ -347,9 +347,9 @@ simplify <- function(x) { } op <- x[[1]]; a <- x[[2]]; b <- x[[3]] - if (rlang::is_symbol(op, c("+", "*", "~"))) { + if (is_symbol(op, c("+", "*", "~"))) { c(simplify(a), simplify(b)) - } else if (rlang::is_symbol(op, "-")) { + } else if (is_symbol(op, "-")) { c(simplify(a), expr(-!!simplify(b))) } else { list(x) @@ -371,21 +371,21 @@ as_facets <- function(x) { return(x) } - if (rlang::is_formula(x)) { + if (is_formula(x)) { # Use different formula method because plyr's does not handle the # environment correctly. f_as_facets(x) } else { vars <- as_quoted(x) - rlang::as_quosures(vars, globalenv(), named = TRUE) + as_quosures(vars, globalenv(), named = TRUE) } } f_as_facets <- function(f) { if (is.null(f)) { - return(rlang::as_quosures(list())) + return(as_quosures(list())) } - env <- rlang::f_env(f) %||% globalenv() + env <- f_env(f) %||% globalenv() # as.quoted() handles `+` specifications vars <- as.quoted(f) @@ -393,7 +393,7 @@ f_as_facets <- function(f) { # `.` in formulas is ignored vars <- discard_dots(vars) - rlang::as_quosures(vars, env, named = TRUE) + as_quosures(vars, env, named = TRUE) } discard_dots <- function(x) { x[!vapply(x, identical, logical(1), as.name("."))] @@ -406,7 +406,7 @@ is_facets <- function(x) { if (!length(x)) { return(FALSE) } - all(vapply(x, rlang::is_quosure, logical(1))) + all(vapply(x, is_quosure, logical(1))) } @@ -422,8 +422,8 @@ eval_facets <- function(facets, data, env = globalenv()) { tibble::as_tibble(vars) } eval_facet <- function(facet, data, env = emptyenv()) { - if (rlang::quo_is_symbol(facet)) { - facet <- as.character(rlang::quo_get_expr(facet)) + if (quo_is_symbol(facet)) { + facet <- as.character(quo_get_expr(facet)) if (facet %in% names(data)) { out <- data[[facet]] @@ -433,7 +433,7 @@ eval_facet <- function(facet, data, env = emptyenv()) { return(out) } - rlang::eval_tidy(facet, data, env) + eval_tidy(facet, data, env) } layout_null <- function() { diff --git a/R/facet-grid-.r b/R/facet-grid-.r index 4b1ba83357..41400bf668 100644 --- a/R/facet-grid-.r +++ b/R/facet-grid-.r @@ -159,7 +159,7 @@ facet_grid <- function(rows = NULL, cols = NULL, scales = "fixed", # Returns a list of quosures objects. The list has exactly two elements, `rows` and `cols`. grid_as_facets_list <- function(rows, cols) { - is_rows_vars <- is.null(rows) || rlang::is_quosures(rows) + is_rows_vars <- is.null(rows) || is_quosures(rows) if (!is_rows_vars) { if (!is.null(cols)) { stop("`rows` must be `NULL` or a `vars()` list if `cols` is a `vars()` list", call. = FALSE) @@ -170,13 +170,13 @@ grid_as_facets_list <- function(rows, cols) { stop("A grid facet specification can't have more than two dimensions", call. = FALSE) } # Fill with empty quosures - facets <- list(rows = rlang::quos(), cols = rlang::quos()) + facets <- list(rows = quos(), cols = quos()) facets[seq_along(facets_list)] <- facets_list # Do not compact the legacy specs return(facets) } - is_cols_vars <- is.null(cols) || rlang::is_quosures(cols) + is_cols_vars <- is.null(cols) || is_quosures(cols) if (!is_cols_vars) { stop("`cols` must be `NULL` or a `vars()` specification", call. = FALSE) } diff --git a/R/geom-.r b/R/geom-.r index 4f19896ee2..21101bf052 100644 --- a/R/geom-.r +++ b/R/geom-.r @@ -111,7 +111,7 @@ Geom <- ggproto("Geom", # Fill in missing aesthetics with their defaults missing_aes <- setdiff(names(self$default_aes), names(data)) - missing_eval <- lapply(self$default_aes[missing_aes], rlang::eval_tidy) + missing_eval <- lapply(self$default_aes[missing_aes], eval_tidy) # Needed for geoms with defaults set to NULL (e.g. GeomSf) missing_eval <- compact(missing_eval) diff --git a/R/ggplot2.r b/R/ggplot2.r index 9cc72cc618..8c44df5540 100644 --- a/R/ggplot2.r +++ b/R/ggplot2.r @@ -1,6 +1,6 @@ #' @keywords internal "_PACKAGE" -#' @import scales grid gtable +#' @import scales grid gtable rlang #' @importFrom stats setNames NULL diff --git a/R/labels.r b/R/labels.r index ec05d5796c..6b9b1650c6 100644 --- a/R/labels.r +++ b/R/labels.r @@ -66,7 +66,7 @@ update_labels <- function(p, labels) { #' # If you want to remove a label, set it to NULL. #' p + labs(title = "title") + labs(title = NULL) labs <- function(..., title = waiver(), subtitle = waiver(), caption = waiver(), tag = waiver()) { - args <- rlang::list2(..., title = title, subtitle = subtitle, caption = caption, tag = tag) + args <- list2(..., title = title, subtitle = subtitle, caption = caption, tag = tag) is_waive <- vapply(args, is.waive, logical(1)) args <- args[!is_waive] diff --git a/R/layer.r b/R/layer.r index b1f4b74925..72b03609ef 100644 --- a/R/layer.r +++ b/R/layer.r @@ -226,7 +226,7 @@ Layer <- ggproto("Layer", NULL, scales_add_defaults(plot$scales, data, aesthetics, plot$plot_env) # Evaluate and check aesthetics - evaled <- lapply(aesthetics, rlang::eval_tidy, data = data) + evaled <- lapply(aesthetics, eval_tidy, data = data) evaled <- compact(evaled) n <- nrow(data) @@ -279,7 +279,7 @@ Layer <- ggproto("Layer", NULL, env <- new.env(parent = baseenv()) env$stat <- stat - stat_data <- new_data_frame(lapply(new, rlang::eval_tidy, data, env)) + stat_data <- new_data_frame(lapply(new, eval_tidy, data, env)) names(stat_data) <- names(new) # Add any new scales, if needed diff --git a/R/quick-plot.r b/R/quick-plot.r index efb076b246..5ecaaa71ba 100644 --- a/R/quick-plot.r +++ b/R/quick-plot.r @@ -71,11 +71,11 @@ qplot <- function(x, y, ..., data, facets = NULL, margins = FALSE, if (!missing(position)) warning("`position` is deprecated", call. = FALSE) if (!is.character(geom)) stop("`geom` must be a character vector", call. = FALSE) - exprs <- rlang::enquos(x = x, y = y, ..., .ignore_empty = "all") + exprs <- enquos(x = x, y = y, ..., .ignore_empty = "all") # treat arguments as regular parameters if they are wrapped into I() or # if they don't have a name that is in the list of all aesthetics is_constant <- (!names(exprs) %in% ggplot_global$all_aesthetics) | - vapply(exprs, rlang::quo_is_call, logical(1), name = "I") + vapply(exprs, quo_is_call, logical(1), name = "I") mapping <- new_aes(exprs[!is_constant], env = parent.frame()) @@ -86,10 +86,10 @@ qplot <- function(x, y, ..., data, facets = NULL, margins = FALSE, if (is.null(xlab)) { - xlab <- rlang::quo_name(exprs$x) + xlab <- quo_name(exprs$x) } if (is.null(ylab)) { - ylab <- rlang::quo_name(exprs$y) + ylab <- quo_name(exprs$y) } if (missing(data)) { @@ -110,7 +110,7 @@ qplot <- function(x, y, ..., data, facets = NULL, margins = FALSE, if ("sample" %in% aes_names) { geom[geom == "auto"] <- "qq" } else if (missing(y)) { - x <- rlang::eval_tidy(mapping$x, data, caller_env) + x <- eval_tidy(mapping$x, data, caller_env) if (is.discrete(x)) { geom[geom == "auto"] <- "bar" } else { @@ -119,7 +119,7 @@ qplot <- function(x, y, ..., data, facets = NULL, margins = FALSE, if (is.null(ylab)) ylab <- "count" } else { if (missing(x)) { - mapping$x <- rlang::quo(seq_along(!!mapping$y)) + mapping$x <- quo(seq_along(!!mapping$y)) } geom[geom == "auto"] <- "point" } @@ -140,7 +140,7 @@ qplot <- function(x, y, ..., data, facets = NULL, margins = FALSE, # Add geoms/statistics for (g in geom) { # We reevaluate constants once per geom for historical reasons? - params <- lapply(consts, rlang::eval_tidy) + params <- lapply(consts, eval_tidy) p <- p + do.call(paste0("geom_", g), params) } diff --git a/R/scale-manual.r b/R/scale-manual.r index 40c3ff3983..890ed96f1c 100644 --- a/R/scale-manual.r +++ b/R/scale-manual.r @@ -104,7 +104,7 @@ scale_discrete_manual <- function(aesthetics, ..., values) { manual_scale <- function(aesthetic, values = NULL, ...) { # check for missing `values` parameter, in lieu of providing # a default to all the different scale_*_manual() functions - if (rlang::is_missing(values)) { + if (is_missing(values)) { values <- NULL } else { force(values) diff --git a/R/scale-type.R b/R/scale-type.R index ffe2b19cf9..34ccf69308 100644 --- a/R/scale-type.R +++ b/R/scale-type.R @@ -2,7 +2,7 @@ find_scale <- function(aes, x, env = parent.frame()) { # Inf is ambiguous; it can be used either with continuous scales or with # discrete scales, so just skip in the hope that we will have a better guess # with the other layers - if (is.null(x) || (rlang::is_atomic(x) && all(is.infinite(x)))) { + if (is.null(x) || (is_atomic(x) && all(is.infinite(x)))) { return(NULL) } diff --git a/R/scales-.r b/R/scales-.r index b8800417ca..d56036e8cf 100644 --- a/R/scales-.r +++ b/R/scales-.r @@ -96,7 +96,7 @@ scales_add_defaults <- function(scales, data, aesthetics, env) { # No new aesthetics, so no new scales to add if (is.null(new_aesthetics)) return() - datacols <- lapply(aesthetics[new_aesthetics], rlang::eval_tidy, data = data) + datacols <- lapply(aesthetics[new_aesthetics], eval_tidy, data = data) datacols <- compact(datacols) for (aes in names(datacols)) { diff --git a/R/stat-function.r b/R/stat-function.r index 8c76f8e432..89e98d97d2 100644 --- a/R/stat-function.r +++ b/R/stat-function.r @@ -102,7 +102,7 @@ StatFunction <- ggproto("StatFunction", Stat, x_trans <- scales$x$trans$inverse(xseq) } - if (is.formula(fun)) fun <- rlang::as_function(fun) + if (is.formula(fun)) fun <- as_function(fun) new_data_frame(list( x = xseq, diff --git a/R/utilities-tidy-eval.R b/R/utilities-tidy-eval.R index 09fee74149..89b6032245 100644 --- a/R/utilities-tidy-eval.R +++ b/R/utilities-tidy-eval.R @@ -33,7 +33,3 @@ #' @export expr enexpr enexprs #' @export .data NULL - -#' @importFrom rlang quo quos enquo enquos quo_name sym ensym syms -#' ensyms expr exprs enexpr enexprs .data -NULL diff --git a/tests/testthat/helper-facet.r b/tests/testthat/helper-facet.r index 3ffaa0864f..f533f85c0a 100644 --- a/tests/testthat/helper-facet.r +++ b/tests/testthat/helper-facet.r @@ -1,6 +1,6 @@ quos_list <- function(...) { x <- list(...) - names(x) <- rlang::names2(x) + names(x) <- names2(x) structure(x, class = "quosures") } diff --git a/tests/testthat/test-aes-calculated.r b/tests/testthat/test-aes-calculated.r index 8e97dd3ff7..dc393d6a2f 100644 --- a/tests/testthat/test-aes-calculated.r +++ b/tests/testthat/test-aes-calculated.r @@ -16,11 +16,11 @@ test_that("call to stat() is calculated", { }) test_that("strip_dots remove dots around calculated aesthetics", { - expect_identical(strip_dots(aes(..density..))$x, rlang::quo(density)) - expect_identical(strip_dots(aes(mean(..density..)))$x, rlang::quo(mean(density))) + expect_identical(strip_dots(aes(..density..))$x, quo(density)) + expect_identical(strip_dots(aes(mean(..density..)))$x, quo(mean(density))) expect_equal( strip_dots(aes(sapply(..density.., function(x) mean(x)))$x), - rlang::quo(sapply(density, function(x) mean(x))) + quo(sapply(density, function(x) mean(x))) ) }) diff --git a/tests/testthat/test-aes.r b/tests/testthat/test-aes.r index a4be4bf1de..be8bd96c51 100644 --- a/tests/testthat/test-aes.r +++ b/tests/testthat/test-aes.r @@ -2,18 +2,18 @@ context("Creating aesthetic mappings") test_that("aes() captures input expressions", { out <- aes(mpg, wt + 1) - expect_identical(out$x, rlang::quo(mpg)) - expect_identical(out$y, rlang::quo(wt + 1)) + expect_identical(out$x, quo(mpg)) + expect_identical(out$y, quo(wt + 1)) }) test_that("aes_q() uses quoted calls and formulas", { out <- aes_q(quote(mpg), ~ wt + 1) - expect_identical(out$x, rlang::quo(mpg)) - expect_identical(out$y, rlang::quo(wt + 1)) + expect_identical(out$x, quo(mpg)) + expect_identical(out$y, quo(wt + 1)) }) test_that("aes_string() parses strings", { - expect_equal(aes_string("a + b")$x, rlang::quo(a + b)) + expect_equal(aes_string("a + b")$x, quo(a + b)) }) test_that("aes_string() doesn't parse non-strings", { @@ -67,24 +67,24 @@ test_that("constants are not wrapped in quosures", { test_that("assignment methods wrap symbolic objects in quosures", { mapping <- aes(a, b, c = c) mapping[1] <- list(quote(foo)) - expect_identical(mapping[[1]], rlang::new_quosure(quote(foo), globalenv())) + expect_identical(mapping[[1]], new_quosure(quote(foo), globalenv())) mapping[[2]] <- quote(bar) - expect_identical(mapping[[2]], rlang::new_quosure(quote(bar), globalenv())) + expect_identical(mapping[[2]], new_quosure(quote(bar), globalenv())) mapping$c <- quote(baz) - expect_identical(mapping[[3]], rlang::new_quosure(quote(baz), globalenv())) + expect_identical(mapping[[3]], new_quosure(quote(baz), globalenv())) }) test_that("assignment methods pull unwrap constants from quosures", { mapping <- aes(a, b, c = c) - mapping[1] <- list(rlang::quo("foo")) + mapping[1] <- list(quo("foo")) expect_identical(mapping[[1]], "foo") - mapping[[2]] <- rlang::quo("bar") + mapping[[2]] <- quo("bar") expect_identical(mapping[[2]], "bar") - mapping$c <- rlang::quo("baz") + mapping$c <- quo("baz") expect_identical(mapping[[3]], "baz") }) diff --git a/tests/testthat/test-facet-.r b/tests/testthat/test-facet-.r index 133a26bbc2..54913001a3 100644 --- a/tests/testthat/test-facet-.r +++ b/tests/testthat/test-facet-.r @@ -17,9 +17,9 @@ test_that("as_facets_list() coerces strings containing formulas", { }) test_that("as_facets_list() coerces character vectors", { - foo <- rlang::new_quosure(quote(foo), globalenv()) - bar <- rlang::new_quosure(quote(bar), globalenv()) - foobar <- rlang::as_quosures(list(foo, bar), named = TRUE) + foo <- new_quosure(quote(foo), globalenv()) + bar <- new_quosure(quote(bar), globalenv()) + foobar <- as_quosures(list(foo, bar), named = TRUE) expect_identical(as_facets_list("foo"), list(foobar[1])) expect_identical(as_facets_list(c("foo", "bar")), list(foobar[1], foobar[2])) diff --git a/tests/testthat/test-plot-summary-api.R b/tests/testthat/test-plot-summary-api.R index 3c385a0055..a8b2f7f5d9 100644 --- a/tests/testthat/test-plot-summary-api.R +++ b/tests/testthat/test-plot-summary-api.R @@ -115,12 +115,12 @@ test_that("coord summary - coord_flip", { test_that("summarise_layers", { l <- summarise_layers(ggplot_build(p)) - expect_equal(l$mapping[[1]], list(x = rlang::quo(displ), y = rlang::quo(hwy))) + expect_equal(l$mapping[[1]], list(x = quo(displ), y = quo(hwy))) p2 <- p + geom_point(aes(x = displ/2, y = hwy/2)) l2 <- summarise_layers(ggplot_build(p2)) - expect_equal(l2$mapping[[1]], list(x = rlang::quo(displ), y = rlang::quo(hwy))) + expect_equal(l2$mapping[[1]], list(x = quo(displ), y = quo(hwy))) # Here use _identical because the quosures are supposed to be local - expect_identical(l2$mapping[[2]], list(x = rlang::quo(displ/2), y = rlang::quo(hwy/2))) + expect_identical(l2$mapping[[2]], list(x = quo(displ/2), y = quo(hwy/2))) })