Skip to content

Commit

Permalink
Rename other functions
Browse files Browse the repository at this point in the history
  • Loading branch information
InfyniteHeap committed Jun 20, 2024
1 parent c12ab89 commit a6c903b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/cli/self_update/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn with_saved_global_state<S>(

#[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)]
Expand All @@ -47,10 +47,10 @@ pub fn get_path() -> io::Result<Option<String>> {
}

#[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,
)
}
Expand All @@ -66,7 +66,7 @@ fn get_reg_string(root: &Key, subkey: &str, name: &str) -> io::Result<Option<Str
}

#[cfg(windows)]
fn restore_reg_value(root: &Key, subkey: &str, name: &str, p: Option<String>) {
fn restore_reg_string(root: &Key, subkey: &str, name: &str, p: Option<String>) {
let subkey = root.create(subkey).unwrap();
if let Some(p) = p.as_ref() {
subkey.set_string(name, p).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions tests/suite/cli_self_upd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a6c903b

Please sign in to comment.