Remove invisible(NULL) from rust_sitrep and adjust docs#489
Remove invisible(NULL) from rust_sitrep and adjust docs#489agila5 wants to merge 1 commit intoextendr:mainfrom
Conversation
|
This actually might be a good opportunity to return |
JosiahParry
left a comment
There was a problem hiding this comment.
Thank you so much for your help! I think we should take this as an opoprtunity to return something useful from this funciton. Can you make it return invisible(rustup_status)?
| #' Prints out a detailed report on the state of Rust infrastructure on the host machine. | ||
| #' @export | ||
| #' @return Nothing | ||
| #' @return NULL (invisibly) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
#> NULLCreated 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?
Dear all, I decided to create this PR to remove the final
invisible(NULL)line fromrust_sitrep(). I believe that line is redundant since the final call is tocli::cli_informwhich callsrlang::inform, andrlang::informalready returnsinvisible()(which is equivalent toinvisible(NULL)).I also slightly changed the docs to be slightly more specific.