]> git.lizzy.rs Git - rust.git/commitdiff
docs
authorManish Goregaokar <manishsmail@gmail.com>
Wed, 19 Nov 2014 09:02:47 +0000 (14:32 +0530)
committerManish Goregaokar <manishsmail@gmail.com>
Wed, 19 Nov 2014 09:02:47 +0000 (14:32 +0530)
src/types.rs

index ffea017ec00617f11f33b4a5d7ba2c8046254129..930223de77092ec7e91ce2d4601f2f38e32718e9 100644 (file)
@@ -6,13 +6,13 @@
 use rustc::lint::{Context, LintPass, LintArray, Lint, Level};
 use syntax::codemap::Span;
 
-
+/// Handles all the linting of funky types
 pub struct TypePass;
 
 declare_lint!(CLIPPY_BOX_VEC, Warn,
               "Warn on usage of Box<Vec<T>>")
 
-
+/// Matches a type with a provided string, and returns its type parameters if successful
 pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P<Ty>]> {
     match ty.node {
         TyPath(Path {segments: ref seg, ..}, _, _) => {
@@ -35,13 +35,14 @@ pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P<Ty>]>
     }
 }
 
-
-fn span_note_and_lint(cx: &Context, lint: &'static Lint, span: Span, msg: &str, note: &str) {
+/// Lets me span a note only if the lint is shown
+pub fn span_note_and_lint(cx: &Context, lint: &'static Lint, span: Span, msg: &str, note: &str) {
     cx.span_lint(lint, span, msg);
     if cx.current_level(lint) != Level::Allow {
         cx.sess().span_note(span, note);
     }
 }
+
 impl LintPass for TypePass {
     fn get_lints(&self) -> LintArray {
         lint_array!(CLIPPY_BOX_VEC)