refact(rustup): remove unused mut
This commit is contained in:
@@ -31,7 +31,7 @@ impl Backend for Rustup {
|
|||||||
impl_backend_constants!();
|
impl_backend_constants!();
|
||||||
|
|
||||||
fn get_all_installed_packages(&self) -> Result<HashSet<Package>> {
|
fn get_all_installed_packages(&self) -> Result<HashSet<Package>> {
|
||||||
let mut toolchains_vec = self
|
let toolchains_vec = self
|
||||||
.run_toolchain_command(get_info_switches(Repotype::Toolchain))
|
.run_toolchain_command(get_info_switches(Repotype::Toolchain))
|
||||||
.context("Getting installed toolchains")?;
|
.context("Getting installed toolchains")?;
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ impl Backend for Rustup {
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let components: HashSet<Package> = self
|
let components: HashSet<Package> = self
|
||||||
.run_component_command(get_info_switches(Repotype::Component), &mut toolchains_vec)
|
.run_component_command(get_info_switches(Repotype::Component), &toolchains_vec)
|
||||||
.context("Getting installed components")?
|
.context("Getting installed components")?
|
||||||
.iter()
|
.iter()
|
||||||
.map(|name| ["component", name].join("/").into())
|
.map(|name| ["component", name].join("/").into())
|
||||||
@@ -169,22 +169,21 @@ impl Rustup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_component_command(
|
fn run_component_command(&self, args: &[&str], toolchains: &[String]) -> Result<Vec<String>> {
|
||||||
&self,
|
|
||||||
args: &[&str],
|
|
||||||
toolchains: &mut Vec<String>,
|
|
||||||
) -> Result<Vec<String>> {
|
|
||||||
let mut val = Vec::new();
|
let mut val = Vec::new();
|
||||||
|
|
||||||
for toolchain in toolchains {
|
for toolchain in toolchains {
|
||||||
let mut cmd = Command::new(self.get_binary());
|
let mut cmd = Command::new(self.get_binary());
|
||||||
cmd.args(args).arg(&toolchain);
|
cmd.args(args).arg(toolchain);
|
||||||
let output = String::from_utf8(cmd.output()?.stdout)?;
|
let output = String::from_utf8(cmd.output()?.stdout)?;
|
||||||
for component in output.lines() {
|
for component in output.lines() {
|
||||||
install_components(component, toolchain, &mut val);
|
install_components(component, toolchain, &mut val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(val)
|
Ok(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_toolchain_command(&self, args: &[&str]) -> Result<Vec<String>> {
|
fn run_toolchain_command(&self, args: &[&str]) -> Result<Vec<String>> {
|
||||||
let mut cmd = Command::new(self.get_binary());
|
let mut cmd = Command::new(self.get_binary());
|
||||||
cmd.args(args);
|
cmd.args(args);
|
||||||
|
|||||||
Reference in New Issue
Block a user