Make lint descriptions short and to the point; always fitting the column "triggers on".

This commit is contained in:
Georg Brandl 2016-08-06 10:18:36 +02:00
parent 3b5ff0f813
commit b91c1a509e
51 changed files with 340 additions and 243 deletions

140
README.md
View file

@ -19,17 +19,17 @@ Table of contents:
There are 162 lints included in this crate:
name | default | meaning
---------------------------------------------------------------------------------------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[absurd_extreme_comparisons](https://github.com/Manishearth/rust-clippy/wiki#absurd_extreme_comparisons) | warn | a comparison involving a maximum or minimum value involves a case that is always true or always false
name | default | triggers on
---------------------------------------------------------------------------------------------------------------------|---------|----------------------------------------------------------------------------------------------------------------------------------
[absurd_extreme_comparisons](https://github.com/Manishearth/rust-clippy/wiki#absurd_extreme_comparisons) | warn | a comparison with a maximum or minimum value that is always true or false
[almost_swapped](https://github.com/Manishearth/rust-clippy/wiki#almost_swapped) | warn | `foo = bar; bar = foo` sequence
[approx_constant](https://github.com/Manishearth/rust-clippy/wiki#approx_constant) | warn | the approximate of a known float constant (in `std::f64::consts` or `std::f32::consts`) is found; suggests to use the constant
[approx_constant](https://github.com/Manishearth/rust-clippy/wiki#approx_constant) | warn | the approximate of a known float constant (in `std::fXX::consts`)
[assign_op_pattern](https://github.com/Manishearth/rust-clippy/wiki#assign_op_pattern) | warn | assigning the result of an operation on a variable to that same variable
[assign_ops](https://github.com/Manishearth/rust-clippy/wiki#assign_ops) | allow | any assignment operation
[bad_bit_mask](https://github.com/Manishearth/rust-clippy/wiki#bad_bit_mask) | warn | expressions of the form `_ & mask == select` that will only ever return `true` or `false` (because in the example `select` containing bits that `mask` doesn't have)
[assign_ops](https://github.com/Manishearth/rust-clippy/wiki#assign_ops) | allow | any compound assignment operation
[bad_bit_mask](https://github.com/Manishearth/rust-clippy/wiki#bad_bit_mask) | warn | expressions of the form `_ & mask == select` that will only ever return `true` or `false`
[blacklisted_name](https://github.com/Manishearth/rust-clippy/wiki#blacklisted_name) | warn | usage of a blacklisted/placeholder name
[block_in_if_condition_expr](https://github.com/Manishearth/rust-clippy/wiki#block_in_if_condition_expr) | warn | braces can be eliminated in conditions that are expressions, e.g `if { true } ...`
[block_in_if_condition_stmt](https://github.com/Manishearth/rust-clippy/wiki#block_in_if_condition_stmt) | warn | avoid complex blocks in conditions, instead move the block higher and bind it with 'let'; e.g: `if { let x = true; x } ...`
[block_in_if_condition_expr](https://github.com/Manishearth/rust-clippy/wiki#block_in_if_condition_expr) | warn | braces that can be eliminated in conditions, e.g `if { true } ...`
[block_in_if_condition_stmt](https://github.com/Manishearth/rust-clippy/wiki#block_in_if_condition_stmt) | warn | complex blocks in conditions, e.g. `if { let x = true; x } ...`
[bool_comparison](https://github.com/Manishearth/rust-clippy/wiki#bool_comparison) | warn | comparing a variable to a boolean, e.g. `if x == true`
[box_vec](https://github.com/Manishearth/rust-clippy/wiki#box_vec) | warn | usage of `Box<Vec<T>>`, vector elements are already on the heap
[boxed_local](https://github.com/Manishearth/rust-clippy/wiki#boxed_local) | warn | using `Box<T>` where unnecessary
@ -37,25 +37,25 @@ name
[cast_possible_wrap](https://github.com/Manishearth/rust-clippy/wiki#cast_possible_wrap) | allow | casts that may cause wrapping around the value, e.g `x as i32` where `x: u32` and `x > i32::MAX`
[cast_precision_loss](https://github.com/Manishearth/rust-clippy/wiki#cast_precision_loss) | allow | casts that cause loss of precision, e.g `x as f32` where `x: u64`
[cast_sign_loss](https://github.com/Manishearth/rust-clippy/wiki#cast_sign_loss) | allow | casts from signed types to unsigned types, e.g `x as u32` where `x: i32`
[char_lit_as_u8](https://github.com/Manishearth/rust-clippy/wiki#char_lit_as_u8) | warn | Casting a character literal to u8
[char_lit_as_u8](https://github.com/Manishearth/rust-clippy/wiki#char_lit_as_u8) | warn | casting a character literal to u8
[chars_next_cmp](https://github.com/Manishearth/rust-clippy/wiki#chars_next_cmp) | warn | using `.chars().next()` to check if a string starts with a char
[clone_double_ref](https://github.com/Manishearth/rust-clippy/wiki#clone_double_ref) | warn | using `clone` on `&&T`
[clone_on_copy](https://github.com/Manishearth/rust-clippy/wiki#clone_on_copy) | warn | using `clone` on a `Copy` type
[cmp_nan](https://github.com/Manishearth/rust-clippy/wiki#cmp_nan) | deny | comparisons to NAN (which will always return false, which is probably not intended)
[cmp_nan](https://github.com/Manishearth/rust-clippy/wiki#cmp_nan) | deny | comparisons to NAN, which will always return false, probably not intended
[cmp_owned](https://github.com/Manishearth/rust-clippy/wiki#cmp_owned) | warn | creating owned instances for comparing with others, e.g. `x == "foo".to_string()`
[collapsible_if](https://github.com/Manishearth/rust-clippy/wiki#collapsible_if) | warn | `if`s that can be collapsed (e.g. `if x { if y { ... } }` and `else { if x { ... } }`)
[crosspointer_transmute](https://github.com/Manishearth/rust-clippy/wiki#crosspointer_transmute) | warn | transmutes that have to or from types that are a pointer to the other
[cyclomatic_complexity](https://github.com/Manishearth/rust-clippy/wiki#cyclomatic_complexity) | warn | finds functions that should be split up into multiple functions
[deprecated_semver](https://github.com/Manishearth/rust-clippy/wiki#deprecated_semver) | warn | `Warn` on `#[deprecated(since = "x")]` where x is not semver
[cyclomatic_complexity](https://github.com/Manishearth/rust-clippy/wiki#cyclomatic_complexity) | warn | functions that should be split up into multiple functions
[deprecated_semver](https://github.com/Manishearth/rust-clippy/wiki#deprecated_semver) | warn | use of `#[deprecated(since = "x")]` where x is not semver
[derive_hash_xor_eq](https://github.com/Manishearth/rust-clippy/wiki#derive_hash_xor_eq) | warn | deriving `Hash` but implementing `PartialEq` explicitly
[doc_markdown](https://github.com/Manishearth/rust-clippy/wiki#doc_markdown) | warn | checks for the presence of `_`, `::` or camel-case outside ticks in documentation
[double_neg](https://github.com/Manishearth/rust-clippy/wiki#double_neg) | warn | `--x` is a double negation of `x` and not a pre-decrement as in C or C++
[drop_ref](https://github.com/Manishearth/rust-clippy/wiki#drop_ref) | warn | call to `std::mem::drop` with a reference instead of an owned value, which will not call the `Drop::drop` method on the underlying value
[duplicate_underscore_argument](https://github.com/Manishearth/rust-clippy/wiki#duplicate_underscore_argument) | warn | Function arguments having names which only differ by an underscore
[empty_loop](https://github.com/Manishearth/rust-clippy/wiki#empty_loop) | warn | empty `loop {}` detected
[enum_clike_unportable_variant](https://github.com/Manishearth/rust-clippy/wiki#enum_clike_unportable_variant) | warn | finds C-like enums that are `repr(isize/usize)` and have values that don't fit into an `i32`
[enum_glob_use](https://github.com/Manishearth/rust-clippy/wiki#enum_glob_use) | allow | finds use items that import all variants of an enum
[enum_variant_names](https://github.com/Manishearth/rust-clippy/wiki#enum_variant_names) | warn | finds enums where all variants share a prefix/postfix
[doc_markdown](https://github.com/Manishearth/rust-clippy/wiki#doc_markdown) | warn | presence of `_`, `::` or camel-case outside backticks in documentation
[double_neg](https://github.com/Manishearth/rust-clippy/wiki#double_neg) | warn | `--x`, which is a double negation of `x` and not a pre-decrement as in C/C++
[drop_ref](https://github.com/Manishearth/rust-clippy/wiki#drop_ref) | warn | calls to `std::mem::drop` with a reference instead of an owned value
[duplicate_underscore_argument](https://github.com/Manishearth/rust-clippy/wiki#duplicate_underscore_argument) | warn | function arguments having names which only differ by an underscore
[empty_loop](https://github.com/Manishearth/rust-clippy/wiki#empty_loop) | warn | empty `loop {}`, which should block or sleep
[enum_clike_unportable_variant](https://github.com/Manishearth/rust-clippy/wiki#enum_clike_unportable_variant) | warn | C-like enums that are `repr(isize/usize)` and have values that don't fit into an `i32`
[enum_glob_use](https://github.com/Manishearth/rust-clippy/wiki#enum_glob_use) | allow | use items that import all variants of an enum
[enum_variant_names](https://github.com/Manishearth/rust-clippy/wiki#enum_variant_names) | warn | enums where all variants share a prefix/postfix
[eq_op](https://github.com/Manishearth/rust-clippy/wiki#eq_op) | warn | equal operands on both sides of a comparison or bitwise combination (e.g. `x == x`)
[expl_impl_clone_on_copy](https://github.com/Manishearth/rust-clippy/wiki#expl_impl_clone_on_copy) | warn | implementing `Clone` explicitly on `Copy` types
[explicit_counter_loop](https://github.com/Manishearth/rust-clippy/wiki#explicit_counter_loop) | warn | for-looping with an explicit counter when `_.enumerate()` would do
@ -63,22 +63,22 @@ name
[extend_from_slice](https://github.com/Manishearth/rust-clippy/wiki#extend_from_slice) | warn | `.extend_from_slice(_)` is a faster way to extend a Vec by a slice
[filter_map](https://github.com/Manishearth/rust-clippy/wiki#filter_map) | allow | using combinations of `filter`, `map`, `filter_map` and `flat_map` which can usually be written as a single method call
[filter_next](https://github.com/Manishearth/rust-clippy/wiki#filter_next) | warn | using `filter(p).next()`, which is more succinctly expressed as `.find(p)`
[float_arithmetic](https://github.com/Manishearth/rust-clippy/wiki#float_arithmetic) | allow | Any floating-point arithmetic statement
[float_cmp](https://github.com/Manishearth/rust-clippy/wiki#float_cmp) | warn | using `==` or `!=` on float values (as floating-point operations usually involve rounding errors, it is always better to check for approximate equality within small bounds)
[float_arithmetic](https://github.com/Manishearth/rust-clippy/wiki#float_arithmetic) | allow | any floating-point arithmetic statement
[float_cmp](https://github.com/Manishearth/rust-clippy/wiki#float_cmp) | warn | using `==` or `!=` on float values instead of comparing difference with an epsilon
[for_kv_map](https://github.com/Manishearth/rust-clippy/wiki#for_kv_map) | warn | looping on a map using `iter` when `keys` or `values` would do
[for_loop_over_option](https://github.com/Manishearth/rust-clippy/wiki#for_loop_over_option) | warn | for-looping over an `Option`, which is more clearly expressed as an `if let`
[for_loop_over_result](https://github.com/Manishearth/rust-clippy/wiki#for_loop_over_result) | warn | for-looping over a `Result`, which is more clearly expressed as an `if let`
[identity_op](https://github.com/Manishearth/rust-clippy/wiki#identity_op) | warn | using identity operations, e.g. `x + 0` or `y / 1`
[if_not_else](https://github.com/Manishearth/rust-clippy/wiki#if_not_else) | allow | finds if branches that could be swapped so no negation operation is necessary on the condition
[if_not_else](https://github.com/Manishearth/rust-clippy/wiki#if_not_else) | allow | `if` branches that could be swapped so no negation operation is necessary on the condition
[if_same_then_else](https://github.com/Manishearth/rust-clippy/wiki#if_same_then_else) | warn | if with the same *then* and *else* blocks
[ifs_same_cond](https://github.com/Manishearth/rust-clippy/wiki#ifs_same_cond) | warn | consecutive `ifs` with the same condition
[indexing_slicing](https://github.com/Manishearth/rust-clippy/wiki#indexing_slicing) | allow | indexing/slicing usage
[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
[inline_always](https://github.com/Manishearth/rust-clippy/wiki#inline_always) | warn | use of `#[inline(always)]`
[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 | 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
[items_after_statements](https://github.com/Manishearth/rust-clippy/wiki#items_after_statements) | allow | 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
[iter_nth](https://github.com/Manishearth/rust-clippy/wiki#iter_nth) | warn | using `.iter().nth()` on a standard library type with O(1) element access
[len_without_is_empty](https://github.com/Manishearth/rust-clippy/wiki#len_without_is_empty) | warn | traits and impls that have `.len()` but not `.is_empty()`
@ -86,19 +86,19 @@ name
[let_and_return](https://github.com/Manishearth/rust-clippy/wiki#let_and_return) | warn | creating a let-binding and then immediately returning it like `let x = expr; x` at the end of a block
[let_unit_value](https://github.com/Manishearth/rust-clippy/wiki#let_unit_value) | warn | creating a let binding to a value of unit type, which usually can't be used afterwards
[linkedlist](https://github.com/Manishearth/rust-clippy/wiki#linkedlist) | warn | usage of LinkedList, usually a vector is faster, or a more specialized data structure like a VecDeque
[logic_bug](https://github.com/Manishearth/rust-clippy/wiki#logic_bug) | warn | checks for boolean expressions that contain terminals which can be eliminated
[manual_swap](https://github.com/Manishearth/rust-clippy/wiki#manual_swap) | warn | manual swap
[logic_bug](https://github.com/Manishearth/rust-clippy/wiki#logic_bug) | warn | boolean expressions that contain terminals which can be eliminated
[manual_swap](https://github.com/Manishearth/rust-clippy/wiki#manual_swap) | warn | manual swap of two variables
[many_single_char_names](https://github.com/Manishearth/rust-clippy/wiki#many_single_char_names) | warn | too many single character bindings
[map_clone](https://github.com/Manishearth/rust-clippy/wiki#map_clone) | warn | using `.map(|x| x.clone())` to clone an iterator or option's contents (recommends `.cloned()` instead)
[map_clone](https://github.com/Manishearth/rust-clippy/wiki#map_clone) | warn | using `.map(|x| x.clone())` to clone an iterator or option's contents
[map_entry](https://github.com/Manishearth/rust-clippy/wiki#map_entry) | warn | use of `contains_key` followed by `insert` on a `HashMap` or `BTreeMap`
[match_bool](https://github.com/Manishearth/rust-clippy/wiki#match_bool) | warn | a match on boolean expression; recommends `if..else` block instead
[match_overlapping_arm](https://github.com/Manishearth/rust-clippy/wiki#match_overlapping_arm) | warn | a match has overlapping arms
[match_ref_pats](https://github.com/Manishearth/rust-clippy/wiki#match_ref_pats) | warn | a match or `if let` has all arms prefixed with `&`; the match expression can be dereferenced instead
[match_bool](https://github.com/Manishearth/rust-clippy/wiki#match_bool) | warn | a match on a boolean expression instead of an `if..else` block
[match_overlapping_arm](https://github.com/Manishearth/rust-clippy/wiki#match_overlapping_arm) | warn | a match with overlapping arms
[match_ref_pats](https://github.com/Manishearth/rust-clippy/wiki#match_ref_pats) | warn | a match or `if let` with all arms prefixed with `&` instead of deref-ing the match expression
[match_same_arms](https://github.com/Manishearth/rust-clippy/wiki#match_same_arms) | warn | `match` with identical arm bodies
[mem_forget](https://github.com/Manishearth/rust-clippy/wiki#mem_forget) | allow | `mem::forget` usage on `Drop` types is likely to cause memory leaks
[mem_forget](https://github.com/Manishearth/rust-clippy/wiki#mem_forget) | allow | `mem::forget` usage on `Drop` types, likely to cause memory leaks
[min_max](https://github.com/Manishearth/rust-clippy/wiki#min_max) | warn | `min(_, max(_, _))` (or vice versa) with bounds clamping the result to a constant
[misrefactored_assign_op](https://github.com/Manishearth/rust-clippy/wiki#misrefactored_assign_op) | warn | having a variable on both sides of an assign op
[mixed_case_hex_literals](https://github.com/Manishearth/rust-clippy/wiki#mixed_case_hex_literals) | warn | letter digits in hex literals should be either completely upper- or lowercased
[mixed_case_hex_literals](https://github.com/Manishearth/rust-clippy/wiki#mixed_case_hex_literals) | warn | hex literals whose letter digits are not consistently upper- or lowercased
[modulo_one](https://github.com/Manishearth/rust-clippy/wiki#modulo_one) | warn | taking a number modulo 1, which always returns 0
[mut_mut](https://github.com/Manishearth/rust-clippy/wiki#mut_mut) | allow | usage of double-mut refs, e.g. `&mut &mut ...`
[mutex_atomic](https://github.com/Manishearth/rust-clippy/wiki#mutex_atomic) | warn | using a mutex where an atomic value could be used instead
@ -109,74 +109,74 @@ name
[needless_range_loop](https://github.com/Manishearth/rust-clippy/wiki#needless_range_loop) | warn | for-looping over a range of indices where an iterator over items would do
[needless_return](https://github.com/Manishearth/rust-clippy/wiki#needless_return) | warn | using a return statement like `return expr;` where an expression would suffice
[needless_update](https://github.com/Manishearth/rust-clippy/wiki#needless_update) | warn | using `Foo { ..base }` when there are no missing fields
[neg_multiply](https://github.com/Manishearth/rust-clippy/wiki#neg_multiply) | warn | Warns on multiplying integers with -1
[neg_multiply](https://github.com/Manishearth/rust-clippy/wiki#neg_multiply) | warn | multiplying integers with -1
[new_ret_no_self](https://github.com/Manishearth/rust-clippy/wiki#new_ret_no_self) | warn | not returning `Self` in a `new` method
[new_without_default](https://github.com/Manishearth/rust-clippy/wiki#new_without_default) | warn | `fn new() -> Self` method without `Default` implementation
[new_without_default_derive](https://github.com/Manishearth/rust-clippy/wiki#new_without_default_derive) | warn | `fn new() -> Self` without `#[derive]`able `Default` implementation
[no_effect](https://github.com/Manishearth/rust-clippy/wiki#no_effect) | warn | statements with no effect
[non_ascii_literal](https://github.com/Manishearth/rust-clippy/wiki#non_ascii_literal) | allow | using any literal non-ASCII chars in a string literal; suggests using the `\\u` escape instead
[nonminimal_bool](https://github.com/Manishearth/rust-clippy/wiki#nonminimal_bool) | allow | checks for boolean expressions that can be written more concisely
[non_ascii_literal](https://github.com/Manishearth/rust-clippy/wiki#non_ascii_literal) | allow | using any literal non-ASCII chars in a string literal instead of using the `\\u` escape
[nonminimal_bool](https://github.com/Manishearth/rust-clippy/wiki#nonminimal_bool) | allow | boolean expressions that can be written more concisely
[nonsensical_open_options](https://github.com/Manishearth/rust-clippy/wiki#nonsensical_open_options) | warn | nonsensical combination of options for opening a file
[not_unsafe_ptr_arg_deref](https://github.com/Manishearth/rust-clippy/wiki#not_unsafe_ptr_arg_deref) | warn | public functions dereferencing raw pointer arguments but not marked `unsafe`
[ok_expect](https://github.com/Manishearth/rust-clippy/wiki#ok_expect) | warn | using `ok().expect()`, which gives worse error messages than calling `expect` directly on the Result
[option_map_unwrap_or](https://github.com/Manishearth/rust-clippy/wiki#option_map_unwrap_or) | warn | using `Option.map(f).unwrap_or(a)`, which is more succinctly expressed as `map_or(a, f)`
[option_map_unwrap_or_else](https://github.com/Manishearth/rust-clippy/wiki#option_map_unwrap_or_else) | warn | using `Option.map(f).unwrap_or_else(g)`, which is more succinctly expressed as `map_or_else(g, f)`
[option_unwrap_used](https://github.com/Manishearth/rust-clippy/wiki#option_unwrap_used) | allow | using `Option.unwrap()`, which should at least get a better message using `expect()`
[or_fun_call](https://github.com/Manishearth/rust-clippy/wiki#or_fun_call) | warn | using any `*or` method when the `*or_else` would do
[out_of_bounds_indexing](https://github.com/Manishearth/rust-clippy/wiki#out_of_bounds_indexing) | deny | out of bound constant indexing
[overflow_check_conditional](https://github.com/Manishearth/rust-clippy/wiki#overflow_check_conditional) | warn | Using overflow checks which are likely to panic
[panic_params](https://github.com/Manishearth/rust-clippy/wiki#panic_params) | warn | missing parameters in `panic!`
[precedence](https://github.com/Manishearth/rust-clippy/wiki#precedence) | warn | catches operations where precedence may be unclear
[or_fun_call](https://github.com/Manishearth/rust-clippy/wiki#or_fun_call) | warn | using any `*or` method with a function call, which suggests `*or_else`
[out_of_bounds_indexing](https://github.com/Manishearth/rust-clippy/wiki#out_of_bounds_indexing) | deny | out of bounds constant indexing
[overflow_check_conditional](https://github.com/Manishearth/rust-clippy/wiki#overflow_check_conditional) | warn | overflow checks inspired by C which are likely to panic
[panic_params](https://github.com/Manishearth/rust-clippy/wiki#panic_params) | warn | missing parameters in `panic!` calls
[precedence](https://github.com/Manishearth/rust-clippy/wiki#precedence) | warn | operations where precedence may be unclear
[print_stdout](https://github.com/Manishearth/rust-clippy/wiki#print_stdout) | allow | printing on stdout
[ptr_arg](https://github.com/Manishearth/rust-clippy/wiki#ptr_arg) | warn | fn arguments of the type `&Vec<...>` or `&String`, suggesting to use `&[...]` or `&str` instead, respectively
[range_step_by_zero](https://github.com/Manishearth/rust-clippy/wiki#range_step_by_zero) | warn | using Range::step_by(0), which produces an infinite iterator
[range_zip_with_len](https://github.com/Manishearth/rust-clippy/wiki#range_zip_with_len) | warn | zipping iterator with a range when enumerate() would do
[redundant_closure](https://github.com/Manishearth/rust-clippy/wiki#redundant_closure) | warn | using redundant closures, i.e. `|a| foo(a)` (which can be written as just `foo`)
[redundant_closure_call](https://github.com/Manishearth/rust-clippy/wiki#redundant_closure_call) | warn | Closures should not be called in the expression they are defined
[ptr_arg](https://github.com/Manishearth/rust-clippy/wiki#ptr_arg) | warn | arguments of the type `&Vec<...>` (instead of `&[...]`) or `&String` (instead of `&str`)
[range_step_by_zero](https://github.com/Manishearth/rust-clippy/wiki#range_step_by_zero) | warn | using `Range::step_by(0)`, which produces an infinite iterator
[range_zip_with_len](https://github.com/Manishearth/rust-clippy/wiki#range_zip_with_len) | warn | zipping iterator with a range when `enumerate()` would do
[redundant_closure](https://github.com/Manishearth/rust-clippy/wiki#redundant_closure) | warn | redundant closures, i.e. `|a| foo(a)` (which can be written as just `foo`)
[redundant_closure_call](https://github.com/Manishearth/rust-clippy/wiki#redundant_closure_call) | warn | throwaway closures called in the expression they are defined
[redundant_pattern](https://github.com/Manishearth/rust-clippy/wiki#redundant_pattern) | warn | using `name @ _` in a pattern
[regex_macro](https://github.com/Manishearth/rust-clippy/wiki#regex_macro) | warn | finds use of `regex!(_)`, suggests `Regex::new(_)` instead
[regex_macro](https://github.com/Manishearth/rust-clippy/wiki#regex_macro) | warn | use of `regex!(_)` instead of `Regex::new(_)`
[result_unwrap_used](https://github.com/Manishearth/rust-clippy/wiki#result_unwrap_used) | allow | using `Result.unwrap()`, which might be better handled
[reverse_range_loop](https://github.com/Manishearth/rust-clippy/wiki#reverse_range_loop) | warn | Iterating over an empty range, such as `10..0` or `5..5`
[reverse_range_loop](https://github.com/Manishearth/rust-clippy/wiki#reverse_range_loop) | warn | iteration over an empty range, such as `10..0` or `5..5`
[search_is_some](https://github.com/Manishearth/rust-clippy/wiki#search_is_some) | warn | using an iterator search followed by `is_some()`, which is more succinctly expressed as a call to `any()`
[serde_api_misuse](https://github.com/Manishearth/rust-clippy/wiki#serde_api_misuse) | warn | Various things that will negatively affect your serde experience
[serde_api_misuse](https://github.com/Manishearth/rust-clippy/wiki#serde_api_misuse) | warn | various things that will negatively affect your serde experience
[shadow_reuse](https://github.com/Manishearth/rust-clippy/wiki#shadow_reuse) | allow | rebinding a name to an expression that re-uses the original value, e.g. `let x = x + 1`
[shadow_same](https://github.com/Manishearth/rust-clippy/wiki#shadow_same) | allow | rebinding a name to itself, e.g. `let mut x = &mut x`
[shadow_unrelated](https://github.com/Manishearth/rust-clippy/wiki#shadow_unrelated) | allow | The name is re-bound without even using the original value
[shadow_unrelated](https://github.com/Manishearth/rust-clippy/wiki#shadow_unrelated) | allow | rebinding a name without even using the original value
[should_implement_trait](https://github.com/Manishearth/rust-clippy/wiki#should_implement_trait) | warn | defining a method that should be implementing a std trait
[similar_names](https://github.com/Manishearth/rust-clippy/wiki#similar_names) | allow | similarly named items and bindings
[single_char_pattern](https://github.com/Manishearth/rust-clippy/wiki#single_char_pattern) | warn | using a single-character str where a char could be used, e.g. `_.split("x")`
[single_match](https://github.com/Manishearth/rust-clippy/wiki#single_match) | warn | a match statement with a single nontrivial arm (i.e, where the other arm is `_ => {}`) is used; recommends `if let` instead
[single_match_else](https://github.com/Manishearth/rust-clippy/wiki#single_match_else) | allow | a match statement with a two arms where the second arm's pattern is a wildcard; recommends `if let` instead
[string_add](https://github.com/Manishearth/rust-clippy/wiki#string_add) | allow | using `x + ..` where x is a `String`; suggests using `push_str()` instead
[string_add_assign](https://github.com/Manishearth/rust-clippy/wiki#string_add_assign) | allow | using `x = x + ..` where x is a `String`; suggests using `push_str()` instead
[string_lit_as_bytes](https://github.com/Manishearth/rust-clippy/wiki#string_lit_as_bytes) | warn | calling `as_bytes` on a string literal; suggests using a byte string literal instead
[stutter](https://github.com/Manishearth/rust-clippy/wiki#stutter) | allow | finds type names prefixed/postfixed with their containing module's name
[single_match](https://github.com/Manishearth/rust-clippy/wiki#single_match) | warn | a match statement with a single nontrivial arm (i.e, where the other arm is `_ => {}`) instead of `if let`
[single_match_else](https://github.com/Manishearth/rust-clippy/wiki#single_match_else) | allow | a match statement with a two arms where the second arm's pattern is a wildcard instead of `if let`
[string_add](https://github.com/Manishearth/rust-clippy/wiki#string_add) | allow | using `x + ..` where x is a `String` instead of `push_str()`
[string_add_assign](https://github.com/Manishearth/rust-clippy/wiki#string_add_assign) | allow | using `x = x + ..` where x is a `String` instead of `push_str()`
[string_lit_as_bytes](https://github.com/Manishearth/rust-clippy/wiki#string_lit_as_bytes) | warn | calling `as_bytes` on a string literal instead of using a byte string literal
[stutter](https://github.com/Manishearth/rust-clippy/wiki#stutter) | allow | type names prefixed/postfixed with their containing module's name
[suspicious_assignment_formatting](https://github.com/Manishearth/rust-clippy/wiki#suspicious_assignment_formatting) | warn | suspicious formatting of `*=`, `-=` or `!=`
[suspicious_else_formatting](https://github.com/Manishearth/rust-clippy/wiki#suspicious_else_formatting) | warn | suspicious formatting of `else if`
[temporary_assignment](https://github.com/Manishearth/rust-clippy/wiki#temporary_assignment) | warn | assignments to temporaries
[temporary_cstring_as_ptr](https://github.com/Manishearth/rust-clippy/wiki#temporary_cstring_as_ptr) | warn | getting the inner pointer of a temporary `CString`
[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 `&`.
[toplevel_ref_arg](https://github.com/Manishearth/rust-clippy/wiki#toplevel_ref_arg) | warn | an entire binding declared as `ref`, in a function argument or a `let` statement
[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
[type_complexity](https://github.com/Manishearth/rust-clippy/wiki#type_complexity) | warn | usage of very complex types; recommends factoring out parts into `type` definitions
[trivial_regex](https://github.com/Manishearth/rust-clippy/wiki#trivial_regex) | warn | trivial regular expressions
[type_complexity](https://github.com/Manishearth/rust-clippy/wiki#type_complexity) | warn | usage of very complex types that might be better factored 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)
[unnecessary_mut_passed](https://github.com/Manishearth/rust-clippy/wiki#unnecessary_mut_passed) | warn | an argument is passed as a mutable reference although the function/method only demands an immutable reference
[unit_cmp](https://github.com/Manishearth/rust-clippy/wiki#unit_cmp) | warn | comparing unit values
[unnecessary_mut_passed](https://github.com/Manishearth/rust-clippy/wiki#unnecessary_mut_passed) | warn | an argument passed as a mutable reference although the callee only demands an immutable reference
[unnecessary_operation](https://github.com/Manishearth/rust-clippy/wiki#unnecessary_operation) | warn | outer expressions with no effect
[unneeded_field_pattern](https://github.com/Manishearth/rust-clippy/wiki#unneeded_field_pattern) | warn | Struct fields are bound to a wildcard instead of using `..`
[unsafe_removed_from_name](https://github.com/Manishearth/rust-clippy/wiki#unsafe_removed_from_name) | warn | unsafe removed from name
[unseparated_literal_suffix](https://github.com/Manishearth/rust-clippy/wiki#unseparated_literal_suffix) | allow | literal suffixes should be separated with an underscore
[unneeded_field_pattern](https://github.com/Manishearth/rust-clippy/wiki#unneeded_field_pattern) | warn | struct fields bound to a wildcard instead of using `..`
[unsafe_removed_from_name](https://github.com/Manishearth/rust-clippy/wiki#unsafe_removed_from_name) | warn | `unsafe` removed from API names on import
[unseparated_literal_suffix](https://github.com/Manishearth/rust-clippy/wiki#unseparated_literal_suffix) | allow | literals whose suffix is not separated by an underscore
[unused_collect](https://github.com/Manishearth/rust-clippy/wiki#unused_collect) | warn | `collect()`ing an iterator without using the result; this is usually better written as a for loop
[unused_label](https://github.com/Manishearth/rust-clippy/wiki#unused_label) | warn | unused label
[unused_label](https://github.com/Manishearth/rust-clippy/wiki#unused_label) | warn | unused labels
[unused_lifetimes](https://github.com/Manishearth/rust-clippy/wiki#unused_lifetimes) | warn | unused lifetimes in function definitions
[use_debug](https://github.com/Manishearth/rust-clippy/wiki#use_debug) | allow | use `Debug`-based formatting
[use_debug](https://github.com/Manishearth/rust-clippy/wiki#use_debug) | allow | use of `Debug`-based formatting
[used_underscore_binding](https://github.com/Manishearth/rust-clippy/wiki#used_underscore_binding) | allow | using a binding which is prefixed with an underscore
[useless_format](https://github.com/Manishearth/rust-clippy/wiki#useless_format) | warn | useless use of `format!`
[useless_let_if_seq](https://github.com/Manishearth/rust-clippy/wiki#useless_let_if_seq) | warn | Checks for unidiomatic `let mut` declaration followed by initialization in `if`
[useless_let_if_seq](https://github.com/Manishearth/rust-clippy/wiki#useless_let_if_seq) | warn | unidiomatic `let mut` declaration followed by initialization in `if`
[useless_transmute](https://github.com/Manishearth/rust-clippy/wiki#useless_transmute) | warn | transmutes that have the same to and from types or could be a cast/coercion
[useless_vec](https://github.com/Manishearth/rust-clippy/wiki#useless_vec) | warn | useless `vec!`
[while_let_loop](https://github.com/Manishearth/rust-clippy/wiki#while_let_loop) | warn | `loop { if let { ... } else break }` can be written as a `while let` loop
[while_let_loop](https://github.com/Manishearth/rust-clippy/wiki#while_let_loop) | warn | `loop { if let { ... } else break }`, which can be written as a `while let` loop
[while_let_on_iterator](https://github.com/Manishearth/rust-clippy/wiki#while_let_on_iterator) | warn | using a while-let loop instead of a for loop on an iterator
[wrong_pub_self_convention](https://github.com/Manishearth/rust-clippy/wiki#wrong_pub_self_convention) | allow | defining a public method named with an established prefix (like "into_") that takes `self` with the wrong convention
[wrong_self_convention](https://github.com/Manishearth/rust-clippy/wiki#wrong_self_convention) | warn | defining a method named with an established prefix (like "into_") that takes `self` with the wrong convention

View file

@ -28,8 +28,7 @@ use utils::span_lint;
declare_lint! {
pub APPROX_CONSTANT,
Warn,
"the approximate of a known float constant (in `std::f64::consts` or `std::f32::consts`) \
is found; suggests to use the constant"
"the approximate of a known float constant (in `std::fXX::consts`)"
}
// Tuples are of the form (constant, name, min_digits)

View file

@ -17,7 +17,7 @@ use utils::span_lint;
/// ```
declare_restriction_lint! {
pub INTEGER_ARITHMETIC,
"Any integer arithmetic statement"
"any integer arithmetic statement"
}
/// **What it does:** Checks for float arithmetic.
@ -33,7 +33,7 @@ declare_restriction_lint! {
/// ```
declare_restriction_lint! {
pub FLOAT_ARITHMETIC,
"Any floating-point arithmetic statement"
"any floating-point arithmetic statement"
}
#[derive(Copy, Clone, Default)]

View file

@ -24,7 +24,7 @@ use utils::{self, higher};
declare_lint! {
pub OUT_OF_BOUNDS_INDEXING,
Deny,
"out of bound constant indexing"
"out of bounds constant indexing"
}
/// **What it does:** Checks for usage of indexing or slicing.

View file

@ -16,7 +16,7 @@ use utils::{higher, sugg};
/// ```
declare_restriction_lint! {
pub ASSIGN_OPS,
"any assignment operation"
"any compound assignment operation"
}
/// **What it does:** Checks for `a = a op b` or `a = b commutative_op a` patterns.

View file

@ -30,8 +30,9 @@ use utils::paths;
/// fn not_quite_hot_code(..) { ... }
/// ```
declare_lint! {
pub INLINE_ALWAYS, Warn,
"`#[inline(always)]` is a bad idea in most cases"
pub INLINE_ALWAYS,
Warn,
"use of `#[inline(always)]`"
}
/// **What it does:** Checks for `#[deprecated]` annotations with a `since`
@ -48,8 +49,9 @@ declare_lint! {
/// fn something_else(..) { ... }
/// ```
declare_lint! {
pub DEPRECATED_SEMVER, Warn,
"`Warn` on `#[deprecated(since = \"x\")]` where x is not semver"
pub DEPRECATED_SEMVER,
Warn,
"use of `#[deprecated(since = \"x\")]` where x is not semver"
}
#[derive(Copy,Clone)]

View file

@ -39,8 +39,7 @@ use utils::span_lint;
declare_lint! {
pub BAD_BIT_MASK,
Warn,
"expressions of the form `_ & mask == select` that will only ever return `true` or `false` \
(because in the example `select` containing bits that `mask` doesn't have)"
"expressions of the form `_ & mask == select` that will only ever return `true` or `false`"
}
/// **What it does:** Checks for bit masks in comparisons which can be removed

View file

@ -16,8 +16,9 @@ use utils::*;
/// if { true } ..
/// ```
declare_lint! {
pub BLOCK_IN_IF_CONDITION_EXPR, Warn,
"braces can be eliminated in conditions that are expressions, e.g `if { true } ...`"
pub BLOCK_IN_IF_CONDITION_EXPR,
Warn,
"braces that can be eliminated in conditions, e.g `if { true } ...`"
}
/// **What it does:** Checks for `if` conditions that use blocks containing
@ -34,9 +35,9 @@ declare_lint! {
/// if somefunc(|x| { x == 47 }) ..
/// ```
declare_lint! {
pub BLOCK_IN_IF_CONDITION_STMT, Warn,
"avoid complex blocks in conditions, instead move the block higher and bind it \
with 'let'; e.g: `if { let x = true; x } ...`"
pub BLOCK_IN_IF_CONDITION_STMT,
Warn,
"complex blocks in conditions, e.g. `if { let x = true; x } ...`"
}
#[derive(Copy,Clone)]

View file

@ -20,8 +20,9 @@ use utils::{span_lint_and_then, in_macro, snippet_opt, SpanlessEq};
/// if a && true // should be: if a
/// if !(a == b) // should be: if a != b
declare_lint! {
pub NONMINIMAL_BOOL, Allow,
"checks for boolean expressions that can be written more concisely"
pub NONMINIMAL_BOOL,
Allow,
"boolean expressions that can be written more concisely"
}
/// **What it does:** Checks for boolean expressions that contain terminals that
@ -37,8 +38,9 @@ declare_lint! {
/// ```
/// The `b` is unnecessary, the expression is equivalent to `if a`.
declare_lint! {
pub LOGIC_BUG, Warn,
"checks for boolean expressions that contain terminals which can be eliminated"
pub LOGIC_BUG,
Warn,
"boolean expressions that contain terminals which can be eliminated"
}
#[derive(Copy,Clone)]

View file

@ -20,8 +20,9 @@ use utils::{in_macro, LimitStack, span_help_and_lint, paths, match_type};
///
/// **Example:** No. You'll see it when you get the warning.
declare_lint! {
pub CYCLOMATIC_COMPLEXITY, Warn,
"finds functions that should be split up into multiple functions"
pub CYCLOMATIC_COMPLEXITY,
Warn,
"functions that should be split up into multiple functions"
}
pub struct CyclomaticComplexity {

View file

@ -21,8 +21,9 @@ use utils::span_lint;
/// fn doit(foo_bar) { .. }
/// ```
declare_lint! {
pub DOC_MARKDOWN, Warn,
"checks for the presence of `_`, `::` or camel-case outside ticks in documentation"
pub DOC_MARKDOWN,
Warn,
"presence of `_`, `::` or camel-case outside backticks in documentation"
}
#[derive(Clone)]

View file

@ -21,9 +21,9 @@ use utils::{match_def_path, paths, span_note_and_lint};
/// operation_that_requires_mutex_to_be_unlocked();
/// ```
declare_lint! {
pub DROP_REF, Warn,
"call to `std::mem::drop` with a reference instead of an owned value, \
which will not call the `Drop::drop` method on the underlying value"
pub DROP_REF,
Warn,
"calls to `std::mem::drop` with a reference instead of an owned value"
}
#[allow(missing_copy_implementations)]

View file

@ -23,8 +23,9 @@ use utils::span_lint;
/// }
/// ```
declare_lint! {
pub ENUM_CLIKE_UNPORTABLE_VARIANT, Warn,
"finds C-like enums that are `repr(isize/usize)` and have values that don't fit into an `i32`"
pub ENUM_CLIKE_UNPORTABLE_VARIANT,
Warn,
"C-like enums that are `repr(isize/usize)` and have values that don't fit into an `i32`"
}
pub struct UnportableVariant;

View file

@ -21,8 +21,11 @@ use utils::span_lint;
/// ```rust
/// use std::cmp::Ordering::*;
/// ```
declare_lint! { pub ENUM_GLOB_USE, Allow,
"finds use items that import all variants of an enum" }
declare_lint! {
pub ENUM_GLOB_USE,
Allow,
"use items that import all variants of an enum"
}
pub struct EnumGlobUse;

View file

@ -23,8 +23,9 @@ use utils::{camel_case_from, camel_case_until, in_macro};
/// }
/// ```
declare_lint! {
pub ENUM_VARIANT_NAMES, Warn,
"finds enums where all variants share a prefix/postfix"
pub ENUM_VARIANT_NAMES,
Warn,
"enums where all variants share a prefix/postfix"
}
/// **What it does:** Detects type names that are prefixed or suffixed by the
@ -41,8 +42,9 @@ declare_lint! {
/// }
/// ```
declare_lint! {
pub STUTTER, Allow,
"finds type names prefixed/postfixed with their containing module's name"
pub STUTTER,
Allow,
"type names prefixed/postfixed with their containing module's name"
}
pub struct EnumVariantNames {

View file

@ -35,7 +35,9 @@ pub struct Pass {
/// }
/// ```
declare_lint! {
pub BOXED_LOCAL, Warn, "using `Box<T>` where unnecessary"
pub BOXED_LOCAL,
Warn,
"using `Box<T>` where unnecessary"
}
fn is_non_trait_box(ty: ty::Ty) -> bool {

View file

@ -22,8 +22,9 @@ pub struct EtaPass;
/// ```
/// where `foo(_)` is a plain function that takes the exact argument type of `x`.
declare_lint! {
pub REDUNDANT_CLOSURE, Warn,
"using redundant closures, i.e. `|a| foo(a)` (which can be written as just `foo`)"
pub REDUNDANT_CLOSURE,
Warn,
"redundant closures, i.e. `|a| foo(a)` (which can be written as just `foo`)"
}
impl LintPass for EtaPass {

View file

@ -17,7 +17,8 @@ use rustc_const_math::ConstInt;
/// x / 1 + 0 * 1 - 0 | 0
/// ```
declare_lint! {
pub IDENTITY_OP, Warn,
pub IDENTITY_OP,
Warn,
"using identity operations, e.g. `x + 0` or `y / 1`"
}

View file

@ -31,8 +31,9 @@ use utils::span_help_and_lint;
/// }
/// ```
declare_lint! {
pub IF_NOT_ELSE, Allow,
"finds if branches that could be swapped so no negation operation is necessary on the condition"
pub IF_NOT_ELSE,
Allow,
"`if` branches that could be swapped so no negation operation is necessary on the condition"
}
pub struct IfNotElse;

View file

@ -29,7 +29,7 @@ use utils::{in_macro, span_lint};
declare_lint! {
pub ITEMS_AFTER_STATEMENTS,
Allow,
"finds blocks where an item comes after a statement"
"blocks where an item comes after a statement"
}
pub struct ItemsAfterStatements;

View file

@ -22,7 +22,8 @@ use utils::{get_item_name, in_macro, snippet, span_lint, span_lint_and_then, wal
/// if x.len() == 0 { .. }
/// ```
declare_lint! {
pub LEN_ZERO, Warn,
pub LEN_ZERO,
Warn,
"checking `.len() == 0` or `.len() > 0` (or similar) when `.is_empty()` \
could be used instead"
}
@ -45,7 +46,8 @@ declare_lint! {
/// }
/// ```
declare_lint! {
pub LEN_WITHOUT_IS_EMPTY, Warn,
pub LEN_WITHOUT_IS_EMPTY,
Warn,
"traits and impls that have `.len()` but not `.is_empty()`"
}

View file

@ -45,7 +45,7 @@ use utils::{snippet, span_lint_and_then};
declare_lint! {
pub USELESS_LET_IF_SEQ,
Warn,
"Checks for unidiomatic `let mut` declaration followed by initialization in `if`"
"unidiomatic `let mut` declaration followed by initialization in `if`"
}
#[derive(Copy,Clone)]

View file

@ -145,7 +145,7 @@ declare_lint! {
declare_lint! {
pub WHILE_LET_LOOP,
Warn,
"`loop { if let { ... } else break }` can be written as a `while let` loop"
"`loop { if let { ... } else break }`, which can be written as a `while let` loop"
}
/// **What it does:** Checks for using `collect()` on an iterator without using
@ -186,7 +186,7 @@ declare_lint! {
declare_lint! {
pub REVERSE_RANGE_LOOP,
Warn,
"Iterating over an empty range, such as `10..0` or `5..5`"
"iteration over an empty range, such as `10..0` or `5..5`"
}
/// **What it does:** Checks `for` loops over slices with an explicit counter
@ -224,7 +224,7 @@ declare_lint! {
declare_lint! {
pub EMPTY_LOOP,
Warn,
"empty `loop {}` detected"
"empty `loop {}`, which should block or sleep"
}
/// **What it does:** Checks for `while let` expressions on iterators.

View file

@ -16,9 +16,9 @@ use utils::{is_adjusted, match_path, match_trait_method, match_type, paths, snip
/// x.map(|e| e.clone());
/// ```
declare_lint! {
pub MAP_CLONE, Warn,
"using `.map(|x| x.clone())` to clone an iterator or option's contents (recommends \
`.cloned()` instead)"
pub MAP_CLONE,
Warn,
"using `.map(|x| x.clone())` to clone an iterator or option's contents"
}
#[derive(Copy, Clone)]

View file

@ -27,9 +27,10 @@ use utils::sugg::Sugg;
/// }
/// ```
declare_lint! {
pub SINGLE_MATCH, Warn,
pub SINGLE_MATCH,
Warn,
"a match statement with a single nontrivial arm (i.e, where the other arm \
is `_ => {}`) is used; recommends `if let` instead"
is `_ => {}`) instead of `if let`"
}
/// **What it does:** Checks for matches with a two arms where an `if let` will
@ -47,9 +48,10 @@ declare_lint! {
/// }
/// ```
declare_lint! {
pub SINGLE_MATCH_ELSE, Allow,
"a match statement with a two arms where the second arm's pattern is a wildcard; \
recommends `if let` instead"
pub SINGLE_MATCH_ELSE,
Allow,
"a match statement with a two arms where the second arm's pattern is a wildcard \
instead of `if let`"
}
/// **What it does:** Checks for matches where all arms match a reference,
@ -70,9 +72,9 @@ declare_lint! {
/// }
/// ```
declare_lint! {
pub MATCH_REF_PATS, Warn,
"a match or `if let` has all arms prefixed with `&`; the match expression can be \
dereferenced instead"
pub MATCH_REF_PATS,
Warn,
"a match or `if let` with all arms prefixed with `&` instead of deref-ing the match expression"
}
/// **What it does:** Checks for matches where match expression is a `bool`. It
@ -91,8 +93,9 @@ declare_lint! {
/// }
/// ```
declare_lint! {
pub MATCH_BOOL, Warn,
"a match on boolean expression; recommends `if..else` block instead"
pub MATCH_BOOL,
Warn,
"a match on a boolean expression instead of an `if..else` block"
}
/// **What it does:** Checks for overlapping match arms.
@ -112,7 +115,9 @@ declare_lint! {
/// }
/// ```
declare_lint! {
pub MATCH_OVERLAPPING_ARM, Warn, "a match has overlapping arms"
pub MATCH_OVERLAPPING_ARM,
Warn,
"a match with overlapping arms"
}
#[allow(missing_copy_implementations)]

View file

@ -16,7 +16,7 @@ use utils::{match_def_path, paths, span_lint};
declare_lint! {
pub MEM_FORGET,
Allow,
"`mem::forget` usage on `Drop` types is likely to cause memory leaks"
"`mem::forget` usage on `Drop` types, likely to cause memory leaks"
}
pub struct MemForget;

View file

@ -34,7 +34,8 @@ pub struct Pass;
/// x.unwrap()
/// ```
declare_lint! {
pub OPTION_UNWRAP_USED, Allow,
pub OPTION_UNWRAP_USED,
Allow,
"using `Option.unwrap()`, which should at least get a better message using `expect()`"
}
@ -55,7 +56,8 @@ declare_lint! {
/// x.unwrap()
/// ```
declare_lint! {
pub RESULT_UNWRAP_USED, Allow,
pub RESULT_UNWRAP_USED,
Allow,
"using `Result.unwrap()`, which might be better handled"
}
@ -79,7 +81,8 @@ declare_lint! {
/// }
/// ```
declare_lint! {
pub SHOULD_IMPLEMENT_TRAIT, Warn,
pub SHOULD_IMPLEMENT_TRAIT,
Warn,
"defining a method that should be implementing a std trait"
}
@ -107,7 +110,8 @@ declare_lint! {
/// }
/// ```
declare_lint! {
pub WRONG_SELF_CONVENTION, Warn,
pub WRONG_SELF_CONVENTION,
Warn,
"defining a method named with an established prefix (like \"into_\") that takes \
`self` with the wrong convention"
}
@ -128,7 +132,8 @@ declare_lint! {
/// }
/// ```
declare_lint! {
pub WRONG_PUB_SELF_CONVENTION, Allow,
pub WRONG_PUB_SELF_CONVENTION,
Allow,
"defining a public method named with an established prefix (like \"into_\") that takes \
`self` with the wrong convention"
}
@ -145,7 +150,8 @@ declare_lint! {
/// x.ok().expect("why did I do this again?")
/// ```
declare_lint! {
pub OK_EXPECT, Warn,
pub OK_EXPECT,
Warn,
"using `ok().expect()`, which gives worse error messages than \
calling `expect` directly on the Result"
}
@ -162,7 +168,8 @@ declare_lint! {
/// x.map(|a| a + 1).unwrap_or(0)
/// ```
declare_lint! {
pub OPTION_MAP_UNWRAP_OR, Warn,
pub OPTION_MAP_UNWRAP_OR,
Warn,
"using `Option.map(f).unwrap_or(a)`, which is more succinctly expressed as \
`map_or(a, f)`"
}
@ -179,7 +186,8 @@ declare_lint! {
/// x.map(|a| a + 1).unwrap_or_else(some_function)
/// ```
declare_lint! {
pub OPTION_MAP_UNWRAP_OR_ELSE, Warn,
pub OPTION_MAP_UNWRAP_OR_ELSE,
Warn,
"using `Option.map(f).unwrap_or_else(g)`, which is more succinctly expressed as \
`map_or_else(g, f)`"
}
@ -196,7 +204,8 @@ declare_lint! {
/// iter.filter(|x| x == 0).next()
/// ```
declare_lint! {
pub FILTER_NEXT, Warn,
pub FILTER_NEXT,
Warn,
"using `filter(p).next()`, which is more succinctly expressed as `.find(p)`"
}
@ -214,8 +223,10 @@ declare_lint! {
/// iter.filter(|x| x == 0).map(|x| x * 2)
/// ```
declare_lint! {
pub FILTER_MAP, Allow,
"using combinations of `filter`, `map`, `filter_map` and `flat_map` which can usually be written as a single method call"
pub FILTER_MAP,
Allow,
"using combinations of `filter`, `map`, `filter_map` and `flat_map` which can \
usually be written as a single method call"
}
/// **What it does:** Checks for an iterator search (such as `find()`,
@ -231,7 +242,8 @@ declare_lint! {
/// iter.find(|x| x == 0).is_some()
/// ```
declare_lint! {
pub SEARCH_IS_SOME, Warn,
pub SEARCH_IS_SOME,
Warn,
"using an iterator search followed by `is_some()`, which is more succinctly \
expressed as a call to `any()`"
}
@ -249,7 +261,8 @@ declare_lint! {
/// name.chars().next() == Some('_')
/// ```
declare_lint! {
pub CHARS_NEXT_CMP, Warn,
pub CHARS_NEXT_CMP,
Warn,
"using `.chars().next()` to check if a string starts with a char"
}
@ -276,8 +289,9 @@ declare_lint! {
/// foo.unwrap_or_default()
/// ```
declare_lint! {
pub OR_FUN_CALL, Warn,
"using any `*or` method when the `*or_else` would do"
pub OR_FUN_CALL,
Warn,
"using any `*or` method with a function call, which suggests `*or_else`"
}
/// **What it does:** Checks for usage of `.extend(s)` on a `Vec` to extend the
@ -293,7 +307,8 @@ declare_lint! {
/// my_vec.extend(&xs)
/// ```
declare_lint! {
pub EXTEND_FROM_SLICE, Warn,
pub EXTEND_FROM_SLICE,
Warn,
"`.extend_from_slice(_)` is a faster way to extend a Vec by a slice"
}
@ -309,7 +324,9 @@ declare_lint! {
/// 42u64.clone()
/// ```
declare_lint! {
pub CLONE_ON_COPY, Warn, "using `clone` on a `Copy` type"
pub CLONE_ON_COPY,
Warn,
"using `clone` on a `Copy` type"
}
/// **What it does:** Checks for usage of `.clone()` on an `&&T`.
@ -329,7 +346,9 @@ declare_lint! {
/// }
/// ```
declare_lint! {
pub CLONE_DOUBLE_REF, Warn, "using `clone` on `&&T`"
pub CLONE_DOUBLE_REF,
Warn,
"using `clone` on `&&T`"
}
/// **What it does:** Checks for `new` not returning `Self`.
@ -347,7 +366,9 @@ declare_lint! {
/// }
/// ```
declare_lint! {
pub NEW_RET_NO_SELF, Warn, "not returning `Self` in a `new` method"
pub NEW_RET_NO_SELF,
Warn,
"not returning `Self` in a `new` method"
}
/// **What it does:** Checks for string methods that receive a single-character

View file

@ -20,7 +20,8 @@ use utils::{match_def_path, paths, span_lint};
/// It will always be equal to `0`. Probably the author meant to clamp the value
/// between 0 and 100, but has erroneously swapped `min` and `max`.
declare_lint! {
pub MIN_MAX, Warn,
pub MIN_MAX,
Warn,
"`min(_, max(_, _))` (or vice versa) with bounds clamping the result to a constant"
}

View file

@ -35,10 +35,9 @@ use utils::sugg::Sugg;
/// fn foo(ref x: u8) -> bool { .. }
/// ```
declare_lint! {
pub 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 `&`."
pub TOPLEVEL_REF_ARG,
Warn,
"an entire binding declared as `ref`, in a function argument or a `let` statement"
}
#[allow(missing_copy_implementations)]
@ -111,8 +110,11 @@ impl LateLintPass for TopLevelRefPass {
/// ```rust
/// x == NAN
/// ```
declare_lint!(pub CMP_NAN, Deny,
"comparisons to NAN (which will always return false, which is probably not intended)");
declare_lint! {
pub CMP_NAN,
Deny,
"comparisons to NAN, which will always return false, probably not intended"
}
#[derive(Copy,Clone)]
pub struct CmpNan;
@ -165,10 +167,11 @@ fn check_nan(cx: &LateContext, path: &Path, span: Span) {
/// y == 1.23f64
/// y != x // where both are floats
/// ```
declare_lint!(pub FLOAT_CMP, Warn,
"using `==` or `!=` on float values (as floating-point operations \
usually involve rounding errors, it is always better to check for approximate \
equality within small bounds)");
declare_lint! {
pub FLOAT_CMP,
Warn,
"using `==` or `!=` on float values instead of comparing difference with an epsilon"
}
#[derive(Copy,Clone)]
pub struct FloatCmp;
@ -257,8 +260,11 @@ fn is_float(cx: &LateContext, expr: &Expr) -> bool {
/// ```rust
/// x.to_owned() == y
/// ```
declare_lint!(pub CMP_OWNED, Warn,
"creating owned instances for comparing with others, e.g. `x == \"foo\".to_string()`");
declare_lint! {
pub CMP_OWNED,
Warn,
"creating owned instances for comparing with others, e.g. `x == \"foo\".to_string()`"
}
#[derive(Copy,Clone)]
pub struct CmpOwned;
@ -353,7 +359,11 @@ fn is_str_arg(cx: &LateContext, args: &[P<Expr>]) -> bool {
/// ```rust
/// x % 1
/// ```
declare_lint!(pub MODULO_ONE, Warn, "taking a number modulo 1, which always returns 0");
declare_lint! {
pub MODULO_ONE,
Warn,
"taking a number modulo 1, which always returns 0"
}
#[derive(Copy,Clone)]
pub struct ModuloOne;
@ -389,7 +399,11 @@ impl LateLintPass for ModuloOne {
/// y @ _ => (), // easier written as `y`,
/// }
/// ```
declare_lint!(pub REDUNDANT_PATTERN, Warn, "using `name @ _` in a pattern");
declare_lint! {
pub REDUNDANT_PATTERN,
Warn,
"using `name @ _` in a pattern"
}
#[derive(Copy,Clone)]
pub struct PatternPass;
@ -431,8 +445,11 @@ impl LateLintPass for PatternPass {
/// let y = _x + 1; // Here we are using `_x`, even though it has a leading underscore.
/// // We should rename `_x` to `x`
/// ```
declare_lint!(pub USED_UNDERSCORE_BINDING, Allow,
"using a binding which is prefixed with an underscore");
declare_lint! {
pub USED_UNDERSCORE_BINDING,
Allow,
"using a binding which is prefixed with an underscore"
}
#[derive(Copy, Clone)]
pub struct UsedUnderscoreBinding;

View file

@ -18,8 +18,9 @@ use utils::{span_lint, span_help_and_lint, snippet, snippet_opt, span_lint_and_t
/// let { a: _, b: ref b, c: _ } = ..
/// ```
declare_lint! {
pub UNNEEDED_FIELD_PATTERN, Warn,
"Struct fields are bound to a wildcard instead of using `..`"
pub UNNEEDED_FIELD_PATTERN,
Warn,
"struct fields bound to a wildcard instead of using `..`"
}
/// **What it does:** Checks for function arguments having the similar names
@ -34,8 +35,9 @@ declare_lint! {
/// fn foo(a: i32, _a: i32) {}
/// ```
declare_lint! {
pub DUPLICATE_UNDERSCORE_ARGUMENT, Warn,
"Function arguments having names which only differ by an underscore"
pub DUPLICATE_UNDERSCORE_ARGUMENT,
Warn,
"function arguments having names which only differ by an underscore"
}
/// **What it does:** Detects closures called in the same expression where they are defined.
@ -49,8 +51,9 @@ declare_lint! {
/// (|| 42)()
/// ```
declare_lint! {
pub REDUNDANT_CLOSURE_CALL, Warn,
"Closures should not be called in the expression they are defined"
pub REDUNDANT_CLOSURE_CALL,
Warn,
"throwaway closures called in the expression they are defined"
}
/// **What it does:** Detects expressions of the form `--x`.
@ -65,8 +68,9 @@ declare_lint! {
/// --x;
/// ```
declare_lint! {
pub DOUBLE_NEG, Warn,
"`--x` is a double negation of `x` and not a pre-decrement as in C or C++"
pub DOUBLE_NEG,
Warn,
"`--x`, which is a double negation of `x` and not a pre-decrement as in C/C++"
}
/// **What it does:** Warns on hexadecimal literals with mixed-case letter digits.
@ -80,8 +84,9 @@ declare_lint! {
/// let y = 0x1a9BAcD;
/// ```
declare_lint! {
pub MIXED_CASE_HEX_LITERALS, Warn,
"letter digits in hex literals should be either completely upper- or lowercased"
pub MIXED_CASE_HEX_LITERALS,
Warn,
"hex literals whose letter digits are not consistently upper- or lowercased"
}
/// **What it does:** Warns if literal suffixes are not separated by an underscore.
@ -95,8 +100,9 @@ declare_lint! {
/// let y = 123832i32;
/// ```
declare_lint! {
pub UNSEPARATED_LITERAL_SUFFIX, Allow,
"literal suffixes should be separated with an underscore"
pub UNSEPARATED_LITERAL_SUFFIX,
Allow,
"literals whose suffix is not separated by an underscore"
}

View file

@ -19,7 +19,7 @@ use utils::span_lint;
declare_lint! {
pub UNNECESSARY_MUT_PASSED,
Warn,
"an argument is passed as a mutable reference although the function/method only demands an \
"an argument passed as a mutable reference although the callee only demands an \
immutable reference"
}

View file

@ -44,8 +44,7 @@ declare_lint! {
declare_lint! {
pub BOOL_COMPARISON,
Warn,
"comparing a variable to a boolean, e.g. \
`if x == true`"
"comparing a variable to a boolean, e.g. `if x == true`"
}
#[derive(Copy,Clone)]

View file

@ -18,7 +18,7 @@ use utils::span_lint;
declare_lint! {
pub NEG_MULTIPLY,
Warn,
"Warns on multiplying integers with -1"
"multiplying integers with -1"
}
#[derive(Copy, Clone)]

View file

@ -14,8 +14,11 @@ use utils::span_lint;
/// a + b < a
/// ```
declare_lint!(pub OVERFLOW_CHECK_CONDITIONAL, Warn,
"Using overflow checks which are likely to panic");
declare_lint! {
pub OVERFLOW_CHECK_CONDITIONAL,
Warn,
"overflow checks inspired by C which are likely to panic"
}
#[derive(Copy, Clone)]
pub struct OverflowCheckConditional;

View file

@ -18,7 +18,9 @@ use utils::{is_direct_expn_of, match_path, paths, span_lint};
/// panic!("This `panic!` is probably missing a parameter there: {}");
/// ```
declare_lint! {
pub PANIC_PARAMS, Warn, "missing parameters in `panic!`"
pub PANIC_PARAMS,
Warn,
"missing parameters in `panic!` calls"
}
#[allow(missing_copy_implementations)]

View file

@ -19,8 +19,9 @@ use utils::{span_lint, snippet};
/// * `1 << 2 + 3` equals 32, while `(1 << 2) + 3` equals 7
/// * `-1i32.abs()` equals -1, while `(-1i32).abs()` equals 1
declare_lint! {
pub PRECEDENCE, Warn,
"catches operations where precedence may be unclear"
pub PRECEDENCE,
Warn,
"operations where precedence may be unclear"
}
#[derive(Copy,Clone)]

View file

@ -35,7 +35,7 @@ declare_lint! {
declare_lint! {
pub USE_DEBUG,
Allow,
"use `Debug`-based formatting"
"use of `Debug`-based formatting"
}
#[derive(Copy, Clone, Debug)]

View file

@ -23,8 +23,7 @@ use utils::{match_type, paths, span_lint};
declare_lint! {
pub PTR_ARG,
Warn,
"fn arguments of the type `&Vec<...>` or `&String`, suggesting to use `&[...]` or `&str` \
instead, respectively"
"arguments of the type `&Vec<...>` (instead of `&[...]`) or `&String` (instead of `&str`)"
}
#[derive(Copy,Clone)]

View file

@ -17,8 +17,9 @@ use utils::higher;
/// for x in (5..5).step_by(0) { .. }
/// ```
declare_lint! {
pub RANGE_STEP_BY_ZERO, Warn,
"using Range::step_by(0), which produces an infinite iterator"
pub RANGE_STEP_BY_ZERO,
Warn,
"using `Range::step_by(0)`, which produces an infinite iterator"
}
/// **What it does:** Checks for zipping a collection with the range of `0.._.len()`.
///
@ -31,8 +32,9 @@ declare_lint! {
/// x.iter().zip(0..x.len())
/// ```
declare_lint! {
pub RANGE_ZIP_WITH_LEN, Warn,
"zipping iterator with a range when enumerate() would do"
pub RANGE_ZIP_WITH_LEN,
Warn,
"zipping iterator with a range when `enumerate()` would do"
}
#[derive(Copy,Clone)]

View file

@ -27,7 +27,7 @@ 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"
"invalid regular expressions"
}
/// **What it does:** Checks for trivial [regex] creation (with `Regex::new`,
@ -48,7 +48,7 @@ declare_lint! {
declare_lint! {
pub TRIVIAL_REGEX,
Warn,
"finds trivial regular expressions"
"trivial regular expressions"
}
/// **What it does:** Checks for usage of `regex!(_)` which (as of now) is
@ -67,7 +67,7 @@ declare_lint! {
declare_lint! {
pub REGEX_MACRO,
Warn,
"finds use of `regex!(_)`, suggests `Regex::new(_)` instead"
"use of `regex!(_)` instead of `Regex::new(_)`"
}
#[derive(Clone, Default)]

View file

@ -20,7 +20,8 @@ use utils::{span_note_and_lint, span_lint_and_then, snippet_opt, match_path_ast,
/// fn foo(x: usize) { return x; }
/// ```
declare_lint! {
pub NEEDLESS_RETURN, Warn,
pub NEEDLESS_RETURN,
Warn,
"using a return statement like `return expr;` where an expression would suffice"
}
@ -39,7 +40,8 @@ declare_lint! {
/// { let x = ..; x }
/// ```
declare_lint! {
pub LET_AND_RETURN, Warn,
pub LET_AND_RETURN,
Warn,
"creating a let-binding and then immediately returning it like `let x = expr; x` at \
the end of a block"
}

View file

@ -11,8 +11,9 @@ use utils::{span_lint, get_trait_def_id, paths};
///
/// **Example:** Implementing `Visitor::visit_string` but not `Visitor::visit_str`.
declare_lint! {
pub SERDE_API_MISUSE, Warn,
"Various things that will negatively affect your serde experience"
pub SERDE_API_MISUSE,
Warn,
"various things that will negatively affect your serde experience"
}

View file

@ -22,7 +22,8 @@ use utils::{higher, in_external_macro, snippet, span_lint_and_then};
/// let x = &x;
/// ```
declare_lint! {
pub SHADOW_SAME, Allow,
pub SHADOW_SAME,
Allow,
"rebinding a name to itself, e.g. `let mut x = &mut x`"
}
@ -42,9 +43,10 @@ declare_lint! {
/// let x = x + 1;
/// ```
declare_lint! {
pub SHADOW_REUSE, Allow,
pub SHADOW_REUSE,
Allow,
"rebinding a name to an expression that re-uses the original value, e.g. \
`let x = x + 1`"
`let x = x + 1`"
}
/// **What it does:** Checks for bindings that shadow other bindings already in
@ -64,8 +66,9 @@ declare_lint! {
/// let x = y; let x = z; // shadows the earlier binding
/// ```
declare_lint! {
pub SHADOW_UNRELATED, Allow,
"The name is re-bound without even using the original value"
pub SHADOW_UNRELATED,
Allow,
"rebinding a name without even using the original value"
}
#[derive(Copy, Clone)]

View file

@ -21,7 +21,7 @@ use utils::{match_type, paths, span_lint, span_lint_and_then, walk_ptrs_ty, get_
declare_lint! {
pub STRING_ADD_ASSIGN,
Allow,
"using `x = x + ..` where x is a `String`; suggests using `push_str()` instead"
"using `x = x + ..` where x is a `String` instead of `push_str()`"
}
/// **What it does:** Checks for all instances of `x + _` where `x` is of type
@ -49,7 +49,7 @@ declare_lint! {
declare_lint! {
pub STRING_ADD,
Allow,
"using `x + ..` where x is a `String`; suggests using `push_str()` instead"
"using `x + ..` where x is a `String` instead of `push_str()`"
}
/// **What it does:** Checks for the `as_bytes` method called on string literals
@ -67,7 +67,7 @@ declare_lint! {
declare_lint! {
pub STRING_LIT_AS_BYTES,
Warn,
"calling `as_bytes` on a string literal; suggests using a byte string literal instead"
"calling `as_bytes` on a string literal instead of using a byte string literal"
}
#[derive(Copy, Clone)]

View file

@ -21,7 +21,7 @@ use utils::sugg::Sugg;
declare_lint! {
pub MANUAL_SWAP,
Warn,
"manual swap"
"manual swap of two variables"
}
/// **What it does:** Checks for `foo = bar; bar = foo` sequences.

View file

@ -29,7 +29,8 @@ pub struct TypePass;
/// }
/// ```
declare_lint! {
pub BOX_VEC, Warn,
pub BOX_VEC,
Warn,
"usage of `Box<Vec<T>>`, vector elements are already on the heap"
}
@ -56,7 +57,8 @@ declare_lint! {
/// let x = LinkedList::new();
/// ```
declare_lint! {
pub LINKEDLIST, Warn,
pub LINKEDLIST,
Warn,
"usage of LinkedList, usually a vector is faster, or a more specialized data \
structure like a VecDeque"
}
@ -117,7 +119,8 @@ pub struct LetPass;
/// let x = { 1; };
/// ```
declare_lint! {
pub LET_UNIT_VALUE, Warn,
pub LET_UNIT_VALUE,
Warn,
"creating a let binding to a value of unit type, which usually can't be used afterwards"
}
@ -169,8 +172,9 @@ impl LateLintPass for LetPass {
/// { foo(); bar(); baz(); }
/// ```
declare_lint! {
pub UNIT_CMP, Warn,
"comparing unit values (which is always `true` or `false`, respectively)"
pub UNIT_CMP,
Warn,
"comparing unit values"
}
#[allow(missing_copy_implementations)]
@ -227,7 +231,8 @@ pub struct CastPass;
/// let x = u64::MAX; x as f64
/// ```
declare_lint! {
pub CAST_PRECISION_LOSS, Allow,
pub CAST_PRECISION_LOSS,
Allow,
"casts that cause loss of precision, e.g `x as f32` where `x: u64`"
}
@ -247,7 +252,8 @@ declare_lint! {
/// y as u64 // will return 18446744073709551615
/// ```
declare_lint! {
pub CAST_SIGN_LOSS, Allow,
pub CAST_SIGN_LOSS,
Allow,
"casts from signed types to unsigned types, e.g `x as u32` where `x: i32`"
}
@ -266,8 +272,10 @@ declare_lint! {
/// fn as_u8(x: u64) -> u8 { x as u8 }
/// ```
declare_lint! {
pub CAST_POSSIBLE_TRUNCATION, Allow,
"casts that may cause truncation of the value, e.g `x as u8` where `x: u32`, or `x as i32` where `x: f32`"
pub CAST_POSSIBLE_TRUNCATION,
Allow,
"casts that may cause truncation of the value, e.g `x as u8` where `x: u32`, \
or `x as i32` where `x: f32`"
}
/// **What it does:** Checks for casts from an unsigned type to a signed type of
@ -288,8 +296,10 @@ declare_lint! {
/// u32::MAX as i32 // will yield a value of `-1`
/// ```
declare_lint! {
pub CAST_POSSIBLE_WRAP, Allow,
"casts that may cause wrapping around the value, e.g `x as i32` where `x: u32` and `x > i32::MAX`"
pub CAST_POSSIBLE_WRAP,
Allow,
"casts that may cause wrapping around the value, e.g `x as i32` where `x: u32` \
and `x > i32::MAX`"
}
/// Returns the size in bits of an integral type.
@ -494,8 +504,9 @@ impl LateLintPass for CastPass {
/// struct Foo { inner: Rc<Vec<Vec<Box<(u32, u32, u32, u32)>>>> }
/// ```
declare_lint! {
pub TYPE_COMPLEXITY, Warn,
"usage of very complex types; recommends factoring out parts into `type` definitions"
pub TYPE_COMPLEXITY,
Warn,
"usage of very complex types that might be better factored into `type` definitions"
}
#[allow(missing_copy_implementations)]
@ -644,8 +655,9 @@ impl<'v> Visitor<'v> for TypeComplexityVisitor {
/// 'x' as u8
/// ```
declare_lint! {
pub CHAR_LIT_AS_U8, Warn,
"Casting a character literal to u8"
pub CHAR_LIT_AS_U8,
Warn,
"casting a character literal to u8"
}
pub struct CharLitAsU8;
@ -695,9 +707,9 @@ impl LateLintPass for CharLitAsU8 {
/// 100 > std::i32::MAX
/// ```
declare_lint! {
pub ABSURD_EXTREME_COMPARISONS, Warn,
"a comparison involving a maximum or minimum value involves a case that is always \
true or always false"
pub ABSURD_EXTREME_COMPARISONS,
Warn,
"a comparison with a maximum or minimum value that is always true or false"
}
pub struct AbsurdExtremeComparisons;
@ -872,7 +884,8 @@ impl LateLintPass for AbsurdExtremeComparisons {
/// let x : u8 = ...; (x as u32) > 300
/// ```
declare_lint! {
pub INVALID_UPCAST_COMPARISONS, Allow,
pub INVALID_UPCAST_COMPARISONS,
Allow,
"a comparison involving an upcast which is always true or false"
}

View file

@ -14,7 +14,8 @@ use utils::{snippet, span_help_and_lint};
///
/// **Example:** You don't see it, but there may be a zero-width space somewhere in this text.
declare_lint! {
pub ZERO_WIDTH_SPACE, Deny,
pub ZERO_WIDTH_SPACE,
Deny,
"using a zero-width space in a string literal, which is confusing"
}
@ -33,9 +34,10 @@ declare_lint! {
/// let x = "Hä?"
/// ```
declare_lint! {
pub NON_ASCII_LITERAL, Allow,
"using any literal non-ASCII chars in a string literal; suggests \
using the `\\u` escape instead"
pub NON_ASCII_LITERAL,
Allow,
"using any literal non-ASCII chars in a string literal instead of \
using the `\\u` escape"
}
/// **What it does:** Checks for string literals that contain Unicode in a form
@ -50,7 +52,8 @@ declare_lint! {
/// **Example:** You may not see it, but “à” and “à” aren't the same string. The
/// former when escaped is actually `"a\u{300}"` while the latter is `"\u{e0}"`.
declare_lint! {
pub UNICODE_NOT_NFC, Allow,
pub 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)"
}

View file

@ -23,7 +23,7 @@ use utils::span_lint;
declare_lint! {
pub UNSAFE_REMOVED_FROM_NAME,
Warn,
"unsafe removed from name"
"`unsafe` removed from API names on import"
}
pub struct UnsafeNameRemoval;

View file

@ -24,7 +24,7 @@ use utils::{in_macro, span_lint};
declare_lint! {
pub UNUSED_LABEL,
Warn,
"unused label"
"unused labels"
}
pub struct UnusedLabel;

View file

@ -11,8 +11,9 @@ use syntax::ast::*;
///
/// **Example:** Wrong ordering of the util::paths constants.
declare_lint! {
pub CLIPPY_LINTS_INTERNAL, Allow,
"Various things that will negatively affect your clippy experience"
pub CLIPPY_LINTS_INTERNAL,
Allow,
"various things that will negatively affect your clippy experience"
}

View file

@ -72,7 +72,7 @@ def gen_table(lints, link=None):
w_name = max(len(l[1]) for l in lints)
w_desc = max(len(l[3]) for l in lints)
# header and underline
yield '%-*s | default | meaning\n' % (w_name, 'name')
yield '%-*s | default | triggers on\n' % (w_name, 'name')
yield '%s-|-%s-|-%s\n' % ('-' * w_name, '-' * 7, '-' * w_desc)
# one table row per lint
for (_, name, default, meaning) in sorted(lints, key=lambda l: l[1]):