Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions R/rust_sitrep.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' Prints out a detailed report on the state of Rust infrastructure on the host machine.
#' @export
#' @return Nothing
#' @return NULL (invisibly)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cli::cli_inform() returns the value of the message invisibly so this won't be correct.

Can you change this to return invisible(rustup_status) that way there is something useful form the function?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @JosiahParry and thanks for your review! I would be happy to implement the suggested changes but I'm not sure I understand you comment. AFAICT, cli::cli_inform() returns invisible(). For example:

library(cli)
a <- cli_inform("b")
#> b
str(a)
#>  NULL

Created on 2025-12-09 with reprex v2.1.1.9000

Session info
sessioninfo::session_info()
#> Warning in system2("quarto", "-V", stdout = TRUE, env = paste0("TMPDIR=", :
#> running command '"quarto"
#> TMPDIR=C:/Users/andre/AppData/Local/Temp/RtmpCEmlil/file48985c3c46cf -V' had
#> status 1
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.2 (2024-10-31 ucrt)
#>  os       Windows 11 x64 (build 26200)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  Italian_Italy.utf8
#>  ctype    Italian_Italy.utf8
#>  tz       Europe/Rome
#>  date     2025-12-09
#>  pandoc   3.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#>  quarto   NA @ C:\\Users\\andre\\AppData\\Local\\Programs\\Quarto\\bin\\quarto.exe
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date (UTC) lib source
#>  cli         * 3.6.5      2025-04-23 [1] CRAN (R 4.4.2)
#>  digest        0.6.37     2024-08-19 [1] CRAN (R 4.4.2)
#>  evaluate      1.0.3      2025-01-10 [1] CRAN (R 4.4.2)
#>  fastmap       1.2.0      2024-05-15 [1] CRAN (R 4.4.2)
#>  fs            1.6.5      2024-10-30 [1] CRAN (R 4.4.2)
#>  glue          1.8.0      2024-09-30 [1] CRAN (R 4.4.2)
#>  htmltools     0.5.8.1    2024-04-04 [1] CRAN (R 4.4.2)
#>  knitr         1.50.4     2025-07-11 [1] https://yihui.r-universe.dev (R 4.4.2)
#>  lifecycle     1.0.4      2023-11-07 [1] CRAN (R 4.4.2)
#>  reprex        2.1.1.9000 2025-02-25 [1] Github (tidyverse/reprex@07cd5d7)
#>  rlang         1.1.6      2025-04-11 [1] CRAN (R 4.4.3)
#>  rmarkdown     2.29       2024-11-04 [1] CRAN (R 4.4.2)
#>  rstudioapi    0.17.1     2024-10-22 [1] CRAN (R 4.4.2)
#>  sessioninfo   1.2.3      2025-02-05 [1] CRAN (R 4.4.2)
#>  withr         3.0.2      2024-10-28 [1] CRAN (R 4.4.2)
#>  xfun          0.52       2025-04-02 [1] CRAN (R 4.4.2)
#>  yaml          2.3.10     2024-07-26 [1] CRAN (R 4.4.2)
#> 
#>  [1] C:/Users/andre/AppData/Local/R/win-library/4.4
#>  [2] C:/Program Files/R/R-4.4.2/library
#>  * ── Packages attached to the search path.
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Anyway, I would be happy to modify the function such that it returns invisible(rustup_status). My only question in this case is: what happens when rustup_v is NA? Since, in that case, rustup_status is not even defined. Maybe I should set it to NA?

rust_sitrep <- function() {
cargo_v <- get_version("cargo")
cargo_msg <- if (is.na(cargo_v)) {
Expand Down Expand Up @@ -84,8 +84,6 @@ rust_sitrep <- function() {
}

cli::cli_inform(msgs)

invisible(NULL)
}

get_version <- function(cmd) {
Expand Down
2 changes: 1 addition & 1 deletion man/rust_sitrep.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading