Skip to content

Commit 603d2dc

Browse files
committed
test: simplify .display().to_string() in .extend_redactions()
1 parent 390cbe8 commit 603d2dc

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

tests/suite/cli_exact.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ async fn override_again() {
330330
cx.config
331331
.expect(["rustup", "override", "add", "nightly"])
332332
.await
333-
.extend_redactions([("[CWD]", cx.config.current_dir().display().to_string())])
333+
.extend_redactions([("[CWD]", cx.config.current_dir())])
334334
.is_ok()
335335
.with_stdout(snapbox::str![[""]])
336336
.with_stderr(snapbox::str![[r#"
@@ -351,7 +351,7 @@ async fn remove_override() {
351351
cx.config
352352
.expect(["rustup", "override", keyword])
353353
.await
354-
.extend_redactions([("[CWD]", cwd.display().to_string())])
354+
.extend_redactions([("[CWD]", cwd)])
355355
.is_ok()
356356
.with_stdout(snapbox::str![[""]])
357357
.with_stderr(snapbox::str![[r#"
@@ -369,7 +369,7 @@ async fn remove_override_none() {
369369
cx.config
370370
.expect(["rustup", "override", keyword])
371371
.await
372-
.extend_redactions([("[CWD]", cwd.display().to_string())])
372+
.extend_redactions([("[CWD]", cwd)])
373373
.is_ok()
374374
.with_stdout(snapbox::str![[""]])
375375
.with_stderr(snapbox::str![[r#"
@@ -406,7 +406,7 @@ async fn remove_override_with_path() {
406406
dir.path().to_str().unwrap(),
407407
])
408408
.await
409-
.extend_redactions([("[PATH]", dir.path().display().to_string())])
409+
.extend_redactions([("[PATH]", dir.path().to_owned())])
410410
.is_ok()
411411
.with_stdout(snapbox::str![[""]])
412412
.with_stderr(snapbox::str![[r#"
@@ -442,7 +442,7 @@ async fn remove_override_with_path_deleted() {
442442
path.to_str().unwrap(),
443443
])
444444
.await
445-
.extend_redactions([("[PATH]", path.display().to_string())])
445+
.extend_redactions([("[PATH]", path)])
446446
.is_ok()
447447
.with_stdout(snapbox::str![[""]])
448448
.with_stderr(snapbox::str![[r#"
@@ -476,7 +476,7 @@ async fn remove_override_nonexistent() {
476476
cx.config
477477
.expect(["rustup", "override", keyword, "--nonexistent"])
478478
.await
479-
.extend_redactions([("[PATH]", path.display().to_string())])
479+
.extend_redactions([("[PATH]", path)])
480480
.is_ok()
481481
.with_stdout(snapbox::str![[""]])
482482
.with_stderr(snapbox::str![[r#"

tests/suite/cli_misc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ async fn rust_analyzer_proxy_falls_back_external() {
16431643
[("PATH", &*extern_dir.display().to_string())],
16441644
)
16451645
.await
1646-
.extend_redactions([("[REAL_PATH]", real_path.display().to_string())])
1646+
.extend_redactions([("[REAL_PATH]", real_path.to_owned())])
16471647
.with_stderr(snapbox::str![[r#"
16481648
[REAL_PATH]
16491649
@@ -1658,7 +1658,7 @@ async fn rust_analyzer_proxy_falls_back_external() {
16581658
[("PATH", &*extern_dir.display().to_string())],
16591659
)
16601660
.await
1661-
.extend_redactions([("[EXTERN_PATH]", &extern_path.display().to_string())])
1661+
.extend_redactions([("[EXTERN_PATH]", extern_path)])
16621662
.with_stderr(snapbox::str![[r#"
16631663
info: `rust-analyzer` is unavailable for the active toolchain
16641664
info: falling back to "[EXTERN_PATH]"

tests/suite/cli_rustup.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,8 @@ async fn show_toolchain_toolchain_file_override_not_installed() {
11871187
.expect_with_env(["rustup", "show"], [("RUSTUP_AUTO_INSTALL", "0")])
11881188
.await
11891189
.extend_redactions([
1190-
("[RUSTUP_DIR]", &cx.config.rustupdir.to_string()),
1191-
("[TOOLCHAIN_FILE]", &toolchain_file.display().to_string()),
1190+
("[RUSTUP_DIR]", &cx.config.rustupdir.rustupdir),
1191+
("[TOOLCHAIN_FILE]", &toolchain_file),
11921192
])
11931193
.with_stdout(snapbox::str![[r#"
11941194
Default host: [HOST_TRIPLE]
@@ -1676,7 +1676,7 @@ channel = "nightly"
16761676
cx.config
16771677
.expect(["rustup", "toolchain", "install"])
16781678
.await
1679-
.extend_redactions([("[TOOLCHAIN_FILE]", &toolchain_file.display().to_string())])
1679+
.extend_redactions([("[TOOLCHAIN_FILE]", &toolchain_file)])
16801680
.with_stderr(snapbox::str![[r#"
16811681
info: syncing channel updates for 'nightly-[HOST_TRIPLE]'
16821682
info: latest update on 2015-01-02, rust version 1.3.0 (hash-nightly-2)
@@ -1691,7 +1691,7 @@ info: it's active because: overridden by '[TOOLCHAIN_FILE]'
16911691
cx.config
16921692
.expect(["rustup", "toolchain", "install"])
16931693
.await
1694-
.extend_redactions([("[TOOLCHAIN_FILE]", &toolchain_file.display().to_string())])
1694+
.extend_redactions([("[TOOLCHAIN_FILE]", &toolchain_file)])
16951695
.with_stderr(snapbox::str![[r#"
16961696
info: using existing install for 'nightly-[HOST_TRIPLE]'
16971697
info: the active toolchain `nightly-[HOST_TRIPLE]` has been installed
@@ -3636,7 +3636,7 @@ async fn only_toml_in_rust_toolchain_toml() {
36363636
cx.config
36373637
.expect(["rustc", "--version"])
36383638
.await
3639-
.extend_redactions([("[CWD]", &cwd.display().to_string())])
3639+
.extend_redactions([("[CWD]", &cwd)])
36403640
.with_stderr(snapbox::str![[r#"
36413641
...
36423642
error: could not parse override file: '[CWD]/rust-toolchain.toml'[..]
@@ -3658,7 +3658,7 @@ async fn warn_on_duplicate_rust_toolchain_file() {
36583658
cx.config
36593659
.expect(&["rustup", "toolchain", "install"])
36603660
.await
3661-
.extend_redactions([("[CWD]", &cwd.canonicalize().unwrap().display().to_string())])
3661+
.extend_redactions([("[CWD]", &cwd.canonicalize().unwrap())])
36623662
.with_stderr(snapbox::str![[r#"
36633663
...
36643664
warn: both `[CWD]/rust-toolchain` and `[CWD]/rust-toolchain.toml` exist. Using `[CWD]/rust-toolchain`
@@ -3720,7 +3720,7 @@ profile = "minimal"
37203720
cx.config
37213721
.expect(&["rustup", "show", "active-toolchain"])
37223722
.await
3723-
.extend_redactions([("[CWD]", &cwd.display().to_string())])
3723+
.extend_redactions([("[CWD]", &cwd)])
37243724
.with_stdout(snapbox::str![[r#"
37253725
my-custom (overridden by '[CWD]/rust-toolchain.toml')
37263726

tests/suite/cli_self_upd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ async fn update_but_not_installed() {
459459
cx.config
460460
.expect(["rustup", "self", "update"])
461461
.await
462-
.extend_redactions([("[CARGO_DIR]", cx.config.cargodir.display().to_string())])
462+
.extend_redactions([("[CARGO_DIR]", cx.config.cargodir)])
463463
.is_err()
464464
.with_stdout(snapbox::str![[""]])
465465
.with_stderr(snapbox::str![[r#"

0 commit comments

Comments
 (0)