mirror of
https://github.com/openharmony/third_party_rust_clang-sys.git
synced 2026-07-01 09:24:14 -04:00
Add clippy support
This commit is contained in:
+10
@@ -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
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
doc-valid-idents = ["FreeBSD"]
|
||||
@@ -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
@@ -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) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user