From a6c903b2bf40d8393aad465b0aee75c5a403d2e8 Mon Sep 17 00:00:00 2001 From: Rean Fei Date: Thu, 20 Jun 2024 23:51:27 +0800 Subject: [PATCH] Rename other functions --- src/cli/self_update/test.rs | 8 ++++---- src/test.rs | 2 +- tests/suite/cli_self_upd.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cli/self_update/test.rs b/src/cli/self_update/test.rs index b31572f3dae..20200d54ef5 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 8fd91dff65a..1e8ab5c1cfd 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 5658610465c..97f0406de3b 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)