Skip to content

Commit 1060032

Browse files
fix: revert OS specific logic for rust_sitrep() (#448)
* fix: revert OS specific logic for `rust_sitrep()` `rust_sitrep()` no long need osx specific logic as per rustup 1.28. Fixes #447 * tests: remove osx specific test for `rust_sitrep()` and it's snapshot
1 parent cb88f0f commit 1060032

File tree

3 files changed

+5
-49
lines changed

3 files changed

+5
-49
lines changed

R/rust_sitrep.R

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,9 @@ rustup_toolchain_target <- function() {
115115
# ----------------
116116
#
117117
# stable-x86_64-pc-windows-msvc (default)
118-
host <- if (is_osx() && is.na(try_exec_cmd("rustup", "show"))) {
119-
output <- try_exec_cmd("rustc", c("--version", "--verbose"))
120-
host_index <- grep("host:", output)
121-
gsub("host: ", "", output[host_index])
122-
} else {
123-
try_exec_cmd("rustup", "show") |>
124-
stringi::stri_sub(from = 15L) |>
125-
vctrs::vec_slice(1L)
126-
}
118+
host <- try_exec_cmd("rustup", "show") |>
119+
stringi::stri_sub(from = 15L) |>
120+
vctrs::vec_slice(1L)
127121

128122
# > rustup toolchain list
129123
# stable-x86_64-pc-windows-msvc

tests/testthat/_snaps/rust-sitrep.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,7 @@
104104
! Target required-target is required on this host machine
105105
i Run `rustup target add required-target` to install it
106106

107-
# Detects host when default toolchain is not set on OSX
108-
109-
Code
110-
rust_sitrep()
111-
Message
112-
Rust infrastructure sitrep:
113-
v "rustup": 1.0.0 (0000000 0000-00-00)
114-
v "cargo": 1.0.0 (0000000 0000-00-00)
115-
i host: aarch64-apple-darwin
116-
i toolchain: stable-aarch64-apple-darwin
117-
! This toolchain should be default: stable-aarch64-apple-darwin
118-
i Run e.g. `rustup default stable-aarch64-apple-darwin`
119-
120-
# Detects host when default toolchain is not set on non-OSX
107+
# Detects host when default toolchain is not set
121108

122109
Code
123110
rust_sitrep()

tests/testthat/test-rust-sitrep.R

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -130,32 +130,7 @@ test_that("Required target is not available", {
130130
expect_snapshot(rust_sitrep())
131131
})
132132

133-
test_that("Detects host when default toolchain is not set on OSX", {
134-
local_mocked_bindings(is_osx = function() TRUE)
135-
136-
local_mocked_bindings(try_exec_cmd = function(cmd, args) {
137-
if (cmd == "cargo") {
138-
"cargo 1.0.0 (0000000 0000-00-00)"
139-
} else if (cmd == "rustup" & all(args %in% "--version")) {
140-
"rustup 1.0.0 (0000000 0000-00-00)"
141-
} else if (cmd == "rustc") {
142-
"host: aarch64-apple-darwin"
143-
} else if (all(args %in% "--version")) {
144-
"rustup 1.0.0 (0000000 0000-00-00)"
145-
NA_character_
146-
} else if (all(args %in% c("toolchain", "list"))) {
147-
"stable-aarch64-apple-darwin"
148-
} else if (all(args %in% c("target", "list", "--installed"))) {
149-
NA_character_
150-
} else {
151-
NA_character_
152-
}
153-
})
154-
expect_snapshot(rust_sitrep())
155-
})
156-
157-
test_that("Detects host when default toolchain is not set on non-OSX", {
158-
local_mocked_bindings(is_osx = function() FALSE)
133+
test_that("Detects host when default toolchain is not set", {
159134

160135
local_mocked_bindings(try_exec_cmd = function(cmd, args) {
161136
if (cmd == "cargo") {

0 commit comments

Comments
 (0)