mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
process more kinds of metadata
This commit is contained in:
parent
b33abd3876
commit
7bb8ba4631
2 changed files with 8 additions and 19 deletions
|
@ -16,7 +16,7 @@ pub struct Package {
|
|||
pub name: String,
|
||||
pub version: String,
|
||||
id: String,
|
||||
source: Option<()>,
|
||||
source: Option<String>,
|
||||
pub dependencies: Vec<Dependency>,
|
||||
pub targets: Vec<Target>,
|
||||
features: HashMap<String, Vec<String>>,
|
||||
|
@ -31,23 +31,14 @@ pub struct Dependency {
|
|||
kind: Option<String>,
|
||||
optional: bool,
|
||||
uses_default_features: bool,
|
||||
features: Vec<HashMap<String, String>>,
|
||||
features: Vec<String>,
|
||||
target: Option<()>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(RustcDecodable, Debug)]
|
||||
pub enum Kind {
|
||||
dylib,
|
||||
test,
|
||||
bin,
|
||||
lib,
|
||||
}
|
||||
|
||||
#[derive(RustcDecodable, Debug)]
|
||||
pub struct Target {
|
||||
pub name: String,
|
||||
pub kind: Vec<Kind>,
|
||||
pub kind: Vec<String>,
|
||||
src_path: String,
|
||||
}
|
||||
|
||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -126,13 +126,11 @@ pub fn main() {
|
|||
assert_eq!(metadata.version, 1);
|
||||
for target in metadata.packages.remove(0).targets {
|
||||
let args = std::env::args().skip(2);
|
||||
assert_eq!(target.kind.len(), 1);
|
||||
match &target.kind[..] {
|
||||
[cargo::Kind::lib] |
|
||||
[cargo::Kind::dylib] => process(std::iter::once("--lib".to_owned()).chain(args), &dep_path, &sys_root),
|
||||
[cargo::Kind::bin] => process(vec!["--bin".to_owned(), target.name].into_iter().chain(args), &dep_path, &sys_root),
|
||||
// don't process tests and other stuff
|
||||
_ => {},
|
||||
assert!(!target.kind.is_empty());
|
||||
if target.kind.len() > 1 || target.kind[0].ends_with("lib") {
|
||||
process(std::iter::once("--lib".to_owned()).chain(args), &dep_path, &sys_root);
|
||||
} else if target.kind[0] == "bin" {
|
||||
process(vec!["--bin".to_owned(), target.name].into_iter().chain(args), &dep_path, &sys_root);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue