diff --git a/src/cli/self_update/test.rs b/src/cli/self_update/test.rs index b31572f3da..20200d54ef 100644 --- a/src/cli/self_update/test.rs +++ b/src/cli/self_update/test.rs @@ -33,7 +33,7 @@ pub fn with_saved_global_state( #[cfg(windows)] pub fn with_saved_path(f: &mut dyn FnMut()) { - with_saved_reg_value(CURRENT_USER, "Environment", "PATH", f) + with_saved_reg_string(CURRENT_USER, "Environment", "PATH", f) } #[cfg(unix)] @@ -47,10 +47,10 @@ pub fn get_path() -> io::Result> { } #[cfg(windows)] -pub fn with_saved_reg_value(root: &Key, subkey: &str, name: &str, f: &mut dyn FnMut()) { +pub fn with_saved_reg_string(root: &Key, subkey: &str, name: &str, f: &mut dyn FnMut()) { with_saved_global_state( || get_reg_string(root, subkey, name), - |p| restore_reg_value(root, subkey, name, p), + |p| restore_reg_string(root, subkey, name, p), f, ) } @@ -66,7 +66,7 @@ fn get_reg_string(root: &Key, subkey: &str, name: &str) -> io::Result) { +fn restore_reg_string(root: &Key, subkey: &str, name: &str, p: Option) { let subkey = root.create(subkey).unwrap(); if let Some(p) = p.as_ref() { subkey.set_string(name, p).unwrap(); diff --git a/src/test.rs b/src/test.rs index 8fd91dff65..1e8ab5c1cf 100644 --- a/src/test.rs +++ b/src/test.rs @@ -20,7 +20,7 @@ use crate::currentprocess::TestProcess; use crate::dist::TargetTriple; #[cfg(windows)] -pub use crate::cli::self_update::test::{get_path, with_saved_reg_value}; +pub use crate::cli::self_update::test::{get_path, with_saved_reg_string}; // Things that can have environment variables applied to them. pub trait Env { diff --git a/tests/suite/cli_self_upd.rs b/tests/suite/cli_self_upd.rs index 5658610465..97f0406de3 100644 --- a/tests/suite/cli_self_upd.rs +++ b/tests/suite/cli_self_upd.rs @@ -23,7 +23,7 @@ use rustup::utils::{raw, utils}; use rustup::{for_host, DUP_TOOLS, TOOLS}; #[cfg(windows)] -use rustup::test::with_saved_reg_value; +use rustup::test::with_saved_reg_string; const TEST_VERSION: &str = "1.1.1"; @@ -321,7 +321,7 @@ fn update_overwrites_programs_display_version() { let version = env!("CARGO_PKG_VERSION"); update_setup(&|config, _| { - with_saved_reg_value(root, key, name, &mut || { + with_saved_reg_string(root, key, name, &mut || { config.expect_ok(&["rustup-init", "-y", "--no-modify-path"]); // root.create_subkey(key)