mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 17:07:17 +00:00
Synchronise comments with wiki
Wiki commits bfa439b and 9b8ced8.
This commit is contained in:
parent
997a565aeb
commit
95599c6a62
3 changed files with 9 additions and 3 deletions
|
@ -19,7 +19,7 @@ use syntax::codemap::Spanned;
|
|||
use utils::{in_macro, snippet, snippet_block, span_lint_and_then};
|
||||
|
||||
/// **What it does:** This lint checks for nested `if`-statements which can be collapsed by
|
||||
/// `&&`-combining their conditions and for `else { if .. } expressions that can be collapsed to
|
||||
/// `&&`-combining their conditions and for `else { if .. }` expressions that can be collapsed to
|
||||
/// `else if ..`. It is `Warn` by default.
|
||||
///
|
||||
/// **Why is this bad?** Each `if`-statement adds one level of nesting, which makes code look more complex than it really is.
|
||||
|
|
|
@ -29,6 +29,7 @@ use rustc::middle::ty::TypeVariants;
|
|||
/// impl PartialEq for Foo {
|
||||
/// ..
|
||||
/// }
|
||||
/// ```
|
||||
declare_lint! {
|
||||
pub DERIVE_HASH_NOT_EQ,
|
||||
Warn,
|
||||
|
@ -52,6 +53,7 @@ declare_lint! {
|
|||
/// impl Clone for Foo {
|
||||
/// ..
|
||||
/// }
|
||||
/// ```
|
||||
declare_lint! {
|
||||
pub EXPL_IMPL_CLONE_ON_COPY,
|
||||
Warn,
|
||||
|
|
|
@ -5,9 +5,12 @@ use syntax::attr::*;
|
|||
use syntax::ast::*;
|
||||
use utils::in_macro;
|
||||
|
||||
/// **What it does:** It `Warn`s on blocks where there are items that are declared in the middle of or after the statements
|
||||
/// **What it does:** It `Warn`s on blocks where there are items that are declared in the middle of
|
||||
/// or after the statements
|
||||
///
|
||||
/// **Why is this bad?** Items live for the entire scope they are declared in. But statements are processed in order. This might cause confusion as it's hard to figure out which item is meant in a statement.
|
||||
/// **Why is this bad?** Items live for the entire scope they are declared in. But statements are
|
||||
/// processed in order. This might cause confusion as it's hard to figure out which item is meant
|
||||
/// in a statement.
|
||||
///
|
||||
/// **Known problems:** None
|
||||
///
|
||||
|
@ -23,6 +26,7 @@ use utils::in_macro;
|
|||
/// }
|
||||
/// foo(); // prints "foo"
|
||||
/// }
|
||||
/// ```
|
||||
declare_lint! { pub ITEMS_AFTER_STATEMENTS, Warn, "finds blocks where an item comes after a statement" }
|
||||
|
||||
pub struct ItemsAfterStatemets;
|
||||
|
|
Loading…
Reference in a new issue