From ccf996c348a9b591aad7f0b484dd02ac15a37b43 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 26 Dec 2014 05:12:05 +0530 Subject: [PATCH] clippy lint group --- src/lib.rs | 3 +++ src/misc.rs | 6 +++--- src/types.rs | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9ac74eb23..a70327c46 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,4 +22,7 @@ pub fn plugin_registrar(reg: &mut Registry) { reg.register_lint_pass(box misc::MiscPass as LintPassObject); reg.register_lint_pass(box misc::StrToStringPass as LintPassObject); reg.register_lint_pass(box misc::TopLevelRefPass as LintPassObject); + reg.register_lint_group("clippy", vec![types::CLIPPY_BOX_VEC, types::CLIPPY_DLIST, + misc::CLIPPY_SINGLE_MATCH, misc::CLIPPY_STR_TO_STRING, + misc::CLIPPY_TOPLEVEL_REF_ARG]); } diff --git a/src/misc.rs b/src/misc.rs index 4fb0a159a..77520e02d 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -14,7 +14,7 @@ use types::span_note_and_lint; pub struct MiscPass; -declare_lint!(CLIPPY_SINGLE_MATCH, Warn, +declare_lint!(pub CLIPPY_SINGLE_MATCH, Warn, "Warn on usage of matches with a single nontrivial arm"); impl LintPass for MiscPass { @@ -49,7 +49,7 @@ impl LintPass for MiscPass { } -declare_lint!(CLIPPY_STR_TO_STRING, Warn, "Warn when a String could use into_string() instead of to_string()"); +declare_lint!(pub CLIPPY_STR_TO_STRING, Warn, "Warn when a String could use into_string() instead of to_string()"); #[allow(missing_copy_implementations)] pub struct StrToStringPass; @@ -86,7 +86,7 @@ impl LintPass for StrToStringPass { } -declare_lint!(CLIPPY_TOPLEVEL_REF_ARG, Warn, "Warn about pattern matches with top-level `ref` bindings"); +declare_lint!(pub CLIPPY_TOPLEVEL_REF_ARG, Warn, "Warn about pattern matches with top-level `ref` bindings"); #[allow(missing_copy_implementations)] pub struct TopLevelRefPass; diff --git a/src/types.rs b/src/types.rs index f2bedad56..c189e1c38 100644 --- a/src/types.rs +++ b/src/types.rs @@ -10,9 +10,9 @@ use syntax::codemap::Span; #[allow(missing_copy_implementations)] pub struct TypePass; -declare_lint!(CLIPPY_BOX_VEC, Warn, +declare_lint!(pub CLIPPY_BOX_VEC, Warn, "Warn on usage of Box>"); -declare_lint!(CLIPPY_DLIST, Warn, +declare_lint!(pub CLIPPY_DLIST, Warn, "Warn on usage of DList"); /// Matches a type with a provided string, and returns its type parameters if successful