clippy lint group

This commit is contained in:
Manish Goregaokar 2014-12-26 05:12:05 +05:30
parent 32d060ae11
commit ccf996c348
3 changed files with 8 additions and 5 deletions

View file

@ -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]);
}

View file

@ -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;

View file

@ -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<Vec<T>>");
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