Resolve clippy warnings

This commit is contained in:
Jakub Beránek 2023-09-13 18:12:41 +02:00
parent 6c718b5b8a
commit f13b54546b
No known key found for this signature in database
GPG Key ID: 909CD0D26483516B
3 changed files with 6 additions and 8 deletions

View File

@ -33,8 +33,8 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
// We need to manually copy libstd to the extracted rustc sysroot
copy_directory(
&libstd_dir.join("lib").join("rustlib").join(&host_triple).join("lib"),
&rustc_dir.join("lib").join("rustlib").join(&host_triple).join("lib"),
&libstd_dir.join("lib").join("rustlib").join(host_triple).join("lib"),
&rustc_dir.join("lib").join("rustlib").join(host_triple).join("lib"),
)?;
// Extract sources - they aren't in the `rustc-nightly-{host}` tarball, so we need to manually copy libstd
@ -109,6 +109,6 @@ fn find_dist_version(directory: &Utf8Path) -> anyhow::Result<String> {
.unwrap()
.to_string();
let (version, _) =
archive.strip_prefix("reproducible-artifacts-").unwrap().split_once("-").unwrap();
archive.strip_prefix("reproducible-artifacts-").unwrap().split_once('-').unwrap();
Ok(version.to_string())
}

View File

@ -192,7 +192,7 @@ pub fn gather_llvm_bolt_profiles(env: &Environment) -> anyhow::Result<LlvmBoltPr
log::info!("Merging LLVM BOLT profiles to {merged_profile}");
let profiles: Vec<_> =
glob::glob(&format!("{profile_root}*"))?.into_iter().collect::<Result<Vec<_>, _>>()?;
glob::glob(&format!("{profile_root}*"))?.collect::<Result<Vec<_>, _>>()?;
let mut merge_args = vec!["merge-fdata"];
merge_args.extend(profiles.iter().map(|p| p.to_str().unwrap()));

View File

@ -63,7 +63,6 @@ pub fn get_files_from_dir(
let path = format!("{dir}/*{}", suffix.unwrap_or(""));
Ok(glob::glob(&path)?
.into_iter()
.map(|p| p.map(|p| Utf8PathBuf::from_path_buf(p).unwrap()))
.collect::<Result<Vec<_>, _>>()?)
}
@ -74,9 +73,8 @@ pub fn find_file_in_dir(
prefix: &str,
suffix: &str,
) -> anyhow::Result<Utf8PathBuf> {
let files = glob::glob(&format!("{directory}/{prefix}*{suffix}"))?
.into_iter()
.collect::<Result<Vec<_>, _>>()?;
let files =
glob::glob(&format!("{directory}/{prefix}*{suffix}"))?.collect::<Result<Vec<_>, _>>()?;
match files.len() {
0 => Err(anyhow::anyhow!("No file with prefix {prefix} found in {directory}")),
1 => Ok(Utf8PathBuf::from_path_buf(files[0].clone()).unwrap()),