no indexing

This commit is contained in:
Oliver Schneider 2016-06-02 17:39:28 +02:00
parent 7bb8ba4631
commit 078cc68c52
No known key found for this signature in database
GPG key ID: 56D6EEA0FC67AC46

View file

@ -126,11 +126,14 @@ pub fn main() {
assert_eq!(metadata.version, 1); assert_eq!(metadata.version, 1);
for target in metadata.packages.remove(0).targets { for target in metadata.packages.remove(0).targets {
let args = std::env::args().skip(2); let args = std::env::args().skip(2);
assert!(!target.kind.is_empty()); if let Some(first) = target.kind.get(0) {
if target.kind.len() > 1 || target.kind[0].ends_with("lib") { if target.kind.len() > 1 || first.ends_with("lib") {
process(std::iter::once("--lib".to_owned()).chain(args), &dep_path, &sys_root); process(std::iter::once("--lib".to_owned()).chain(args), &dep_path, &sys_root);
} else if target.kind[0] == "bin" { } else if first == "bin" {
process(vec!["--bin".to_owned(), target.name].into_iter().chain(args), &dep_path, &sys_root); process(vec!["--bin".to_owned(), target.name].into_iter().chain(args), &dep_path, &sys_root);
}
} else {
panic!("badly formatted cargo metadata: target::kind is an empty array");
} }
} }
} else { } else {