Add clippy support

This commit is contained in:
Kyle Mayes
2016-05-27 18:00:32 -04:00
parent b16da7d83d
commit 525b1f10ea
5 changed files with 25 additions and 2 deletions
+10
View File
@@ -33,6 +33,16 @@ static = []
bitflags = "0.7.0"
libc = "0.2.11"
[dependencies.clippy]
version = "0.0.69"
optional = true
[build-dependencies]
glob = "0.2.11"
[build-dependencies.clippy]
version = "0.0.69"
optional = true
+8 -1
View File
@@ -1,3 +1,10 @@
//! Finds and links to the required `libclang` libraries.
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
#![cfg_attr(feature="clippy", warn(clippy))]
#![cfg_attr(feature="clippy", allow(if_not_else, similar_names))]
extern crate glob;
use std::env;
@@ -121,7 +128,7 @@ fn get_llvm_libraries() -> Vec<String> {
if p.starts_with("-l") {
Some(p[2..].into())
} else {
get_library_name(&Path::new(p))
get_library_name(Path::new(p))
}
}).collect()
}
+1
View File
@@ -0,0 +1 @@
doc-valid-idents = ["FreeBSD"]
+5
View File
@@ -23,6 +23,11 @@
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
#![cfg_attr(feature="clippy", warn(clippy))]
#![cfg_attr(feature="clippy", allow(if_not_else, similar_names))]
#[macro_use]
extern crate bitflags;
+1 -1
View File
@@ -85,7 +85,7 @@ fn run_clang(path: &Path, arguments: &[&str], stdout: bool) -> String {
fn parse_version(path: &Path) -> CXVersion {
let output = run_clang(path, &["--version"], true);
let start = output.find("version ").unwrap() + 8;
let digits = output[start..].split_whitespace().nth(0).unwrap().split(".");
let digits = output[start..].split_whitespace().nth(0).unwrap().split('.');
let numbers = digits.map(|d| d.parse::<c_int>().unwrap()).collect::<Vec<_>>();
CXVersion { Major: numbers[0], Minor: numbers[1], Subminor: *numbers.get(2).unwrap_or(&0) }
}