refact(rustup): change methods to functions
Remove the methods that don't require access to the backend into separate functions rather than have them as methods. Signed-off-by: innocentzero <isfarulhaque@proton.me>
This commit is contained in:
@@ -139,30 +139,6 @@ impl Rustup {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_install_switches(&self, repotype: &str) -> Switches {
|
||||
match repotype {
|
||||
"toolchain" => &["toolchain", "install"],
|
||||
"component" => &["component", "add", "--toolchain"],
|
||||
_ => panic!("No such type managed by rust"),
|
||||
}
|
||||
}
|
||||
|
||||
fn get_remove_switches(&self, repotype: &str) -> Switches {
|
||||
match repotype {
|
||||
"toolchain" => &["toolchain", "uninstall"],
|
||||
"component" => &["component", "remove", "--toolchain"],
|
||||
_ => panic!("No such type managed by rust"),
|
||||
}
|
||||
}
|
||||
|
||||
fn get_info_switches(&self, repotype: &str) -> Switches {
|
||||
match repotype {
|
||||
"toolchain" => &["toolchain", "list"],
|
||||
"component" => &["component", "list", "--installed", "--toolchain"],
|
||||
_ => panic!("No such type managed by rust"),
|
||||
}
|
||||
}
|
||||
|
||||
fn run_component_command(
|
||||
&self,
|
||||
args: &[&str],
|
||||
@@ -205,3 +181,24 @@ impl Rustup {
|
||||
Ok(val)
|
||||
}
|
||||
}
|
||||
fn get_install_switches(repotype: &str) -> Switches {
|
||||
match repotype {
|
||||
"toolchain" => &["toolchain", "install"],
|
||||
"component" => &["component", "add", "--toolchain"],
|
||||
_ => panic!("No such type managed by rust"),
|
||||
}
|
||||
}
|
||||
fn get_remove_switches(repotype: &str) -> Switches {
|
||||
match repotype {
|
||||
"toolchain" => &["toolchain", "uninstall"],
|
||||
"component" => &["component", "remove", "--toolchain"],
|
||||
_ => panic!("No such type managed by rust"),
|
||||
}
|
||||
}
|
||||
fn get_info_switches(repotype: &str) -> Switches {
|
||||
match repotype {
|
||||
"toolchain" => &["toolchain", "list"],
|
||||
"component" => &["component", "list", "--installed", "--toolchain"],
|
||||
_ => panic!("No such type managed by rust"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user