From 8ac545d0fe224791875ed939db787cb311fac406 Mon Sep 17 00:00:00 2001 From: mcarton Date: Thu, 26 May 2016 00:08:31 +0200 Subject: [PATCH] Fix documentation --- CHANGELOG.md | 2 +- README.md | 4 ++-- src/regex.rs | 12 ++++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 928fac741..719e6ee28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,7 +72,7 @@ All notable changes to this project will be documented in this file. ## ~~0.0.52~~ ## 0.0.51 — 2016-03-13 -* Add `str` to types considered by `len_zero` +* Add `str` to types considered by [`len_zero`] * New lints: [`indexing_slicing`] ## 0.0.50 — 2016-03-11 diff --git a/README.md b/README.md index 4c156dfb7..c28911680 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ name [ineffective_bit_mask](https://github.com/Manishearth/rust-clippy/wiki#ineffective_bit_mask) | warn | expressions where a bit mask will be rendered useless by a comparison, e.g. `(x | 1) > 2` [inline_always](https://github.com/Manishearth/rust-clippy/wiki#inline_always) | warn | `#[inline(always)]` is a bad idea in most cases [integer_arithmetic](https://github.com/Manishearth/rust-clippy/wiki#integer_arithmetic) | allow | Any integer arithmetic statement -[invalid_regex](https://github.com/Manishearth/rust-clippy/wiki#invalid_regex) | deny | finds invalid regular expressions in `Regex::new(_)` invocations +[invalid_regex](https://github.com/Manishearth/rust-clippy/wiki#invalid_regex) | deny | finds invalid regular expressions [invalid_upcast_comparisons](https://github.com/Manishearth/rust-clippy/wiki#invalid_upcast_comparisons) | allow | a comparison involving an upcast which is always true or false [items_after_statements](https://github.com/Manishearth/rust-clippy/wiki#items_after_statements) | allow | finds blocks where an item comes after a statement [iter_next_loop](https://github.com/Manishearth/rust-clippy/wiki#iter_next_loop) | warn | for-looping over `_.next()` which is probably not intended @@ -150,7 +150,7 @@ name [too_many_arguments](https://github.com/Manishearth/rust-clippy/wiki#too_many_arguments) | warn | functions with too many arguments [toplevel_ref_arg](https://github.com/Manishearth/rust-clippy/wiki#toplevel_ref_arg) | warn | An entire binding was declared as `ref`, in a function argument (`fn foo(ref x: Bar)`), or a `let` statement (`let ref x = foo()`). In such cases, it is preferred to take references with `&`. [transmute_ptr_to_ref](https://github.com/Manishearth/rust-clippy/wiki#transmute_ptr_to_ref) | warn | transmutes from a pointer to a reference type -[trivial_regex](https://github.com/Manishearth/rust-clippy/wiki#trivial_regex) | warn | finds trivial regular expressions in `Regex::new(_)` invocations +[trivial_regex](https://github.com/Manishearth/rust-clippy/wiki#trivial_regex) | warn | finds trivial regular expressions [type_complexity](https://github.com/Manishearth/rust-clippy/wiki#type_complexity) | warn | usage of very complex types; recommends factoring out parts into `type` definitions [unicode_not_nfc](https://github.com/Manishearth/rust-clippy/wiki#unicode_not_nfc) | allow | using a unicode literal not in NFC normal form (see [unicode tr15](http://www.unicode.org/reports/tr15/) for further information) [unit_cmp](https://github.com/Manishearth/rust-clippy/wiki#unit_cmp) | warn | comparing unit values (which is always `true` or `false`, respectively) diff --git a/src/regex.rs b/src/regex.rs index b335bf993..c97a64ebf 100644 --- a/src/regex.rs +++ b/src/regex.rs @@ -11,7 +11,8 @@ use syntax::codemap::{Span, BytePos}; use syntax::parse::token::InternedString; use utils::{is_expn_of, match_def_path, match_type, paths, span_lint, span_help_and_lint}; -/// **What it does:** This lint checks `Regex::new(_)` invocations for correct regex syntax. +/// **What it does:** This lint checks [regex] creation (with `Regex::new`, `RegexBuilder::new` or +/// `RegexSet::new`) for correct regex syntax. /// /// **Why is this bad?** This will lead to a runtime panic. /// @@ -21,10 +22,11 @@ use utils::{is_expn_of, match_def_path, match_type, paths, span_lint, span_help_ declare_lint! { pub INVALID_REGEX, Deny, - "finds invalid regular expressions in `Regex::new(_)` invocations" + "finds invalid regular expressions" } -/// **What it does:** This lint checks for `Regex::new(_)` invocations with trivial regex. +/// **What it does:** This lint checks for trivial [regex] creation (with `Regex::new`, +/// `RegexBuilder::new` or `RegexSet::new`). /// /// **Why is this bad?** This can likely be replaced by `==` or `str::starts_with`, /// `str::ends_with` or `std::contains` or other `str` methods. @@ -32,10 +34,12 @@ declare_lint! { /// **Known problems:** None. /// /// **Example:** `Regex::new("^foobar")` +/// +/// [regex]: https://crates.io/crates/regex declare_lint! { pub TRIVIAL_REGEX, Warn, - "finds trivial regular expressions in `Regex::new(_)` invocations" + "finds trivial regular expressions" } /// **What it does:** This lint checks for usage of `regex!(_)` which as of now is usually slower than `Regex::new(_)` unless called in a loop (which is a bad idea anyway).