Integrate clippy into Servo

This commit is contained in:
Manish Goregaokar 2015-08-14 00:06:11 +05:30
parent 3d0951cf25
commit adfe9d249e
5 changed files with 37 additions and 1 deletions

View file

@ -11,3 +11,10 @@ plugin = true
[dependencies.tenacious] [dependencies.tenacious]
git = "https://github.com/servo/rust-tenacious" git = "https://github.com/servo/rust-tenacious"
[dependencies.clippy]
git = "https://github.com/Manishearth/rust-clippy"
branch = "servo"
optional = true
[features]
default = []

View file

@ -21,6 +21,8 @@ extern crate syntax;
extern crate rustc; extern crate rustc;
extern crate tenacious; extern crate tenacious;
#[cfg(feature = "clippy")]
extern crate clippy;
use rustc::lint::LintPassObject; use rustc::lint::LintPassObject;
use rustc::plugin::Registry; use rustc::plugin::Registry;
@ -53,10 +55,19 @@ pub fn plugin_registrar(reg: &mut Registry) {
reg.register_lint_pass(box lints::unrooted_must_root::UnrootedPass::new() as LintPassObject); reg.register_lint_pass(box lints::unrooted_must_root::UnrootedPass::new() as LintPassObject);
reg.register_lint_pass(box lints::privatize::PrivatizePass as LintPassObject); reg.register_lint_pass(box lints::privatize::PrivatizePass as LintPassObject);
reg.register_lint_pass(box lints::inheritance_integrity::InheritancePass as LintPassObject); reg.register_lint_pass(box lints::inheritance_integrity::InheritancePass as LintPassObject);
reg.register_lint_pass(box lints::str_to_string::StrToStringPass as LintPassObject);
reg.register_lint_pass(box lints::ban::BanPass as LintPassObject); reg.register_lint_pass(box lints::ban::BanPass as LintPassObject);
reg.register_lint_pass(box tenacious::TenaciousPass as LintPassObject); reg.register_lint_pass(box tenacious::TenaciousPass as LintPassObject);
reg.register_attribute("must_root".to_string(), Whitelisted); reg.register_attribute("must_root".to_string(), Whitelisted);
reg.register_attribute("servo_lang".to_string(), Whitelisted); reg.register_attribute("servo_lang".to_string(), Whitelisted);
reg.register_attribute("allow_unrooted_interior".to_string(), Whitelisted); reg.register_attribute("allow_unrooted_interior".to_string(), Whitelisted);
register_clippy(reg);
}
#[cfg(feature = "clippy")]
fn register_clippy(reg: &mut Registry) {
::clippy::plugin_registrar(reg);
}
#[cfg(not(feature = "clippy"))]
fn register_clippy(reg: &mut Registry) {
reg.register_lint_pass(box lints::str_to_string::StrToStringPass as LintPassObject);
} }

View file

@ -166,6 +166,11 @@ dependencies = [
"winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "clippy"
version = "0.0.11"
source = "git+https://github.com/Manishearth/rust-clippy?branch=servo#4d5e15ee6e1061ed7da0a91df3510728cabc0a21"
[[package]] [[package]]
name = "clock_ticks" name = "clock_ticks"
version = "0.0.6" version = "0.0.6"
@ -1104,6 +1109,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "plugins" name = "plugins"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"clippy 0.0.11 (git+https://github.com/Manishearth/rust-clippy?branch=servo)",
"tenacious 0.0.9 (git+https://github.com/servo/rust-tenacious)", "tenacious 0.0.9 (git+https://github.com/servo/rust-tenacious)",
] ]

6
ports/cef/Cargo.lock generated
View file

@ -165,6 +165,11 @@ dependencies = [
"winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "clippy"
version = "0.0.11"
source = "git+https://github.com/Manishearth/rust-clippy?branch=servo#4d5e15ee6e1061ed7da0a91df3510728cabc0a21"
[[package]] [[package]]
name = "clock_ticks" name = "clock_ticks"
version = "0.0.6" version = "0.0.6"
@ -1082,6 +1087,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "plugins" name = "plugins"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"clippy 0.0.11 (git+https://github.com/Manishearth/rust-clippy?branch=servo)",
"tenacious 0.0.9 (git+https://github.com/servo/rust-tenacious)", "tenacious 0.0.9 (git+https://github.com/servo/rust-tenacious)",
] ]

6
ports/gonk/Cargo.lock generated
View file

@ -151,6 +151,11 @@ dependencies = [
"winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "clippy"
version = "0.0.11"
source = "git+https://github.com/Manishearth/rust-clippy?branch=servo#4d5e15ee6e1061ed7da0a91df3510728cabc0a21"
[[package]] [[package]]
name = "clock_ticks" name = "clock_ticks"
version = "0.0.6" version = "0.0.6"
@ -988,6 +993,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "plugins" name = "plugins"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"clippy 0.0.11 (git+https://github.com/Manishearth/rust-clippy?branch=servo)",
"tenacious 0.0.9 (git+https://github.com/servo/rust-tenacious)", "tenacious 0.0.9 (git+https://github.com/servo/rust-tenacious)",
] ]