]> git.lizzy.rs Git - rust.git/blobdiff - README.md
Bump to 0.0.137
[rust.git] / README.md
index a3f4dcf4a0b770ed4a2d30bda74d916e931992d4..c5b28812e944be39110bc259037265b252c4a34f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -50,7 +50,7 @@ Then build by enabling the feature: `cargo build --features "clippy"`
 
 Instead of adding the `cfg_attr` attributes you can also run clippy on demand:
 `cargo rustc --features clippy -- -Z no-trans -Z extra-plugins=clippy`
-(the `-Z no trans`, while not neccessary, will stop the compilation process after
+(the `-Z no trans`, while not necessary, will stop the compilation process after
 typechecking (and lints) have completed, which can significantly reduce the runtime).
 
 ### As a cargo subcommand (`cargo clippy`)
@@ -80,7 +80,7 @@ To have cargo compile your crate with clippy without needing `#![plugin(clippy)]
 in your code, you can use:
 
 ```terminal
-cargo rustc -- -L /path/to/clippy_so -Z extra-plugins=clippy
+cargo rustc -- -L /path/to/clippy_so/dir/ -Z extra-plugins=clippy
 ```
 
 *[Note](https://github.com/Manishearth/rust-clippy/wiki#a-word-of-warning):*
@@ -180,7 +180,7 @@ transparently:
 
 ## Lints
 
-There are 192 lints included in this crate:
+There are 198 lints included in this crate:
 
 name                                                                                                                   | default | triggers on
 -----------------------------------------------------------------------------------------------------------------------|---------|----------------------------------------------------------------------------------------------------------------------------------
@@ -191,16 +191,16 @@ name
 [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 that can be eliminated in conditions, e.g `if { true } ...`
+[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
 [builtin_type_shadow](https://github.com/Manishearth/rust-clippy/wiki#builtin_type_shadow)                             | warn    | shadowing a builtin type
-[cast_possible_truncation](https://github.com/Manishearth/rust-clippy/wiki#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`
-[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`
+[cast_possible_truncation](https://github.com/Manishearth/rust-clippy/wiki#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`
+[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
 [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`
@@ -218,6 +218,7 @@ name
 [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++
 [double_parens](https://github.com/Manishearth/rust-clippy/wiki#double_parens)                                         | warn    | Warn on unnecessary double parentheses
+[drop_copy](https://github.com/Manishearth/rust-clippy/wiki#drop_copy)                                                 | warn    | calls to `std::mem::drop` with a value that implements Copy
 [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_enum](https://github.com/Manishearth/rust-clippy/wiki#empty_enum)                                               | allow   | enum with no variants
@@ -238,6 +239,7 @@ name
 [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`
+[forget_copy](https://github.com/Manishearth/rust-clippy/wiki#forget_copy)                                             | warn    | calls to `std::mem::forget` with a value that implements Copy
 [forget_ref](https://github.com/Manishearth/rust-clippy/wiki#forget_ref)                                               | warn    | calls to `std::mem::forget` with a reference instead of an owned value
 [get_unwrap](https://github.com/Manishearth/rust-clippy/wiki#get_unwrap)                                               | warn    | using `.get().unwrap()` or `.get_mut().unwrap()` when using `[]` would work instead
 [identity_op](https://github.com/Manishearth/rust-clippy/wiki#identity_op)                                             | warn    | using identity operations, e.g. `x + 0` or `y / 1`
@@ -286,13 +288,14 @@ name
 [mutex_integer](https://github.com/Manishearth/rust-clippy/wiki#mutex_integer)                                         | allow   | using a mutex for an integer type
 [needless_bool](https://github.com/Manishearth/rust-clippy/wiki#needless_bool)                                         | warn    | if-statements with plain booleans in the then- and else-clause, e.g. `if p { true } else { false }`
 [needless_borrow](https://github.com/Manishearth/rust-clippy/wiki#needless_borrow)                                     | warn    | taking a reference that is going to be automatically dereferenced
+[needless_continue](https://github.com/Manishearth/rust-clippy/wiki#needless_continue)                                 | warn    | `continue` statements that can be replaced by a rearrangement of code
 [needless_lifetimes](https://github.com/Manishearth/rust-clippy/wiki#needless_lifetimes)                               | warn    | using explicit lifetimes for references in function arguments when elision rules would allow omitting them
+[needless_pass_by_value](https://github.com/Manishearth/rust-clippy/wiki#needless_pass_by_value)                       | warn    | functions taking arguments by value, but not consuming them in its body
 [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_take_by_value](https://github.com/Manishearth/rust-clippy/wiki#needless_take_by_value)                       | warn    | taking arguments by value, but only using them by reference
 [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    | multiplying integers with -1
-[never_loop](https://github.com/Manishearth/rust-clippy/wiki#never_loop)                                               | warn    | any loop with an unconditional `break` statement
+[never_loop](https://github.com/Manishearth/rust-clippy/wiki#never_loop)                                               | allow   | any loop with an unconditional `break` or `return` statement
 [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
@@ -302,6 +305,7 @@ name
 [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
+[op_ref](https://github.com/Manishearth/rust-clippy/wiki#op_ref)                                                       | warn    | taking a reference to satisfy the type constraints on `==`
 [option_map_unwrap_or](https://github.com/Manishearth/rust-clippy/wiki#option_map_unwrap_or)                           | allow   | 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)                 | allow   | 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()`
@@ -334,7 +338,7 @@ name
 [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 `_ => {}`) instead of `if let`
+[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()`
@@ -352,6 +356,7 @@ name
 [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
+[unnecessary_cast](https://github.com/Manishearth/rust-clippy/wiki#unnecessary_cast)                                   | warn    | cast to the same type, e.g. `x as i32` where `x: i32`
 [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 bound to a wildcard instead of using `..`
@@ -375,6 +380,7 @@ name
 [wrong_transmute](https://github.com/Manishearth/rust-clippy/wiki#wrong_transmute)                                     | warn    | transmutes that are confusing at best, undefined behaviour at worst and always useless
 [zero_divided_by_zero](https://github.com/Manishearth/rust-clippy/wiki#zero_divided_by_zero)                           | warn    | usage of `0.0 / 0.0` to obtain NaN instead of std::f32::NaN or std::f64::NaN
 [zero_prefixed_literal](https://github.com/Manishearth/rust-clippy/wiki#zero_prefixed_literal)                         | warn    | integer literals starting with `0`
+[zero_ptr](https://github.com/Manishearth/rust-clippy/wiki#zero_ptr)                                                   | warn    | using 0 as *{const, mut} T
 [zero_width_space](https://github.com/Manishearth/rust-clippy/wiki#zero_width_space)                                   | deny    | using a zero-width space in a string literal, which is confusing
 
 More to come, please [file an issue](https://github.com/Manishearth/rust-clippy/issues) if you have ideas!