Deduplicate info.used_crate_source indexing

This commit is contained in:
bjorn3 2021-07-05 17:37:45 +02:00
parent 8748e37d35
commit 5added38c9

View File

@ -263,9 +263,10 @@ pub fn each_linked_rlib(
None => return Err("could not find formats for rlibs".to_string()),
}
let name = &info.crate_name[&cnum];
let path = if let Some((path, _)) = &info.used_crate_source[&cnum].rlib {
let used_crate_source = &info.used_crate_source[&cnum];
let path = if let Some((path, _)) = &used_crate_source.rlib {
path
} else if info.used_crate_source[&cnum].rmeta.is_some() {
} else if used_crate_source.rmeta.is_some() {
return Err(format!(
"could not find rlib for: `{}`, found rmeta (metadata) file",
name