diff --git a/src/config.rs b/src/config.rs index 0ffd8ed5..936e374d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -796,7 +796,7 @@ impl Config { } if self.repos != LocalRepos::None { - let repos = repo::repo_aur_dbs(self).1; + let (_, repos) = repo::repo_aur_dbs(self); if repos.is_empty() { bail!( @@ -1170,10 +1170,7 @@ pub fn version() { println!(" - libalpm v{}", alpm::version()); } -fn question(question: AnyQuestion, data: &mut (bool, Colors)) { - let no_confirm = data.0; - let c = data.1; - +fn question(question: AnyQuestion, (no_confirm, c): &mut (bool, Colors)) { match question.question() { Question::SelectProvider(mut question) => { let providers = question.providers(); @@ -1203,7 +1200,7 @@ fn question(question: AnyQuestion, data: &mut (bool, Colors)) { print!("{}) {} ", n + 1, pkg.name()); } - let index = get_provider(len, no_confirm); + let index = get_provider(len, *no_confirm); question.set_index(index as i32); } Question::InstallIgnorepkg(mut question) => { diff --git a/src/devel.rs b/src/devel.rs index be556aa3..36672b61 100644 --- a/src/devel.rs +++ b/src/devel.rs @@ -115,7 +115,7 @@ pub async fn gendb(config: &mut Config) -> Result<()> { let pkgs = db.pkgs().iter().map(|p| p.name()).collect::>(); let ignore = &config.ignore; - let mut aur = split_repo_aur_pkgs(config, &pkgs).1; + let (_, mut aur) = split_repo_aur_pkgs(config, &pkgs); let mut devel_info = load_devel_info(config)?.unwrap_or_default(); aur.retain(|pkg| { @@ -321,11 +321,11 @@ fn parse_url(source: &str) -> Option<(String, &'_ str, Option<&'_ str>)> { let mut split = rest.splitn(2, '#'); let remote = split.next().unwrap(); - let remote = remote.split_once('?').map_or(remote, |x| x.0); + let remote = remote.split_once('?').map_or(remote, |(x, _)| x); let remote = format!("{}://{}", protocol, remote); let branch = if let Some(fragment) = split.next() { - let fragment = fragment.split_once('?').map_or(fragment, |x| x.0); + let fragment = fragment.split_once('?').map_or(fragment, |(x, _)| x); let mut split = fragment.splitn(2, '='); let frag_type = split.next().unwrap(); diff --git a/src/install.rs b/src/install.rs index 867beb6a..e7c132cc 100644 --- a/src/install.rs +++ b/src/install.rs @@ -659,9 +659,9 @@ impl Installer { repo::add(config, path, &name, &paths)?; repo::refresh(config, &[name])?; } else { - let path = repo.1; - repo::add(config, path, repo.0, &paths)?; - repo::refresh(config, &[repo.0])?; + let (name, path) = repo; + repo::add(config, path, name, &paths)?; + repo::refresh(config, &[name])?; } if let Some(info) = self.new_devel_info.info.remove(base.package_base()) { self.devel_info @@ -852,7 +852,7 @@ impl Installer { self.failed.push(base.clone()); let repo_server = repo_server .as_ref() - .map(|rs| (rs.0.as_str(), rs.1.as_str())); + .map(|(name, file)| (name.as_str(), file.as_str())); let err = self.build_install_pkgbuild(config, base, repo_server); @@ -965,9 +965,9 @@ impl Installer { repo: Some(config.aur_namespace()), pkg: p, })); - targets.extend(self.upgrades.pkgbuild_keep.iter().map(|p| Targ { - repo: Some(&p.0), - pkg: &p.1, + targets.extend(self.upgrades.pkgbuild_keep.iter().map(|(repo, pkg)| Targ { + repo: Some(repo), + pkg, })); targets.extend(self.upgrades.repo_keep.iter().map(Targ::from)); @@ -1235,8 +1235,8 @@ impl Installer { self.remove_make.extend( actions .iter_pkgbuilds() - .filter(|p| p.1.make) - .map(|p| p.1.pkg.pkgname.clone()), + .filter(|(_, p)| p.make) + .map(|(_, p)| p.pkg.pkgname.clone()), ); } @@ -1843,7 +1843,7 @@ fn chroot(config: &Config) -> Chroot { fn trim_dep_ver(dep: &str, trim: bool) -> &str { if trim { - dep.split_once(is_ver_char).map_or(dep, |x| x.0) + dep.split_once(is_ver_char).map_or(dep, |(x, _)| x) } else { dep } diff --git a/src/lib.rs b/src/lib.rs index 503cf50e..59f6426e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -134,8 +134,8 @@ pub async fn run>(args: &[S]) -> i32 { let mut config = match Config::new() { Ok(config) => config, Err(err) => { - let code = if let Some(e) = err.downcast_ref::() { - e.0 + let code = if let Some(&install::Status(e)) = err.downcast_ref() { + e } else { 1 }; @@ -146,8 +146,8 @@ pub async fn run>(args: &[S]) -> i32 { match run2(&mut config, args).await { Err(err) => { - let code = if let Some(e) = err.downcast_ref::() { - e.0 + let code = if let Some(&install::Status(e)) = err.downcast_ref() { + e } else { 1 };