Skip to content

Commit

Permalink
Make lint descriptions short and to the point; always fitting the col…
Browse files Browse the repository at this point in the history
…umn "triggers on".
  • Loading branch information
birkenfeld committed Aug 7, 2016
1 parent 3b5ff0f commit b91c1a5
Show file tree
Hide file tree
Showing 51 changed files with 340 additions and 243 deletions.
140 changes: 70 additions & 70 deletions README.md

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions clippy_lints/src/approx_const.rs
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/arithmetic.rs
Expand Up @@ -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.
Expand All @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/array_indexing.rs
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/assign_ops.rs
Expand Up @@ -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.
Expand Down
10 changes: 6 additions & 4 deletions clippy_lints/src/attrs.rs
Expand Up @@ -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`
Expand All @@ -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)]
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/bit_mask.rs
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions clippy_lints/src/block_in_if_condition.rs
Expand Up @@ -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
Expand All @@ -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)]
Expand Down
10 changes: 6 additions & 4 deletions clippy_lints/src/booleans.rs
Expand Up @@ -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
Expand All @@ -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)]
Expand Down
5 changes: 3 additions & 2 deletions clippy_lints/src/cyclomatic_complexity.rs
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions clippy_lints/src/doc.rs
Expand Up @@ -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)]
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/drop_ref.rs
Expand Up @@ -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)]
Expand Down
5 changes: 3 additions & 2 deletions clippy_lints/src/enum_clike.rs
Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions clippy_lints/src/enum_glob_use.rs
Expand Up @@ -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;

Expand Down
10 changes: 6 additions & 4 deletions clippy_lints/src/enum_variants.rs
Expand Up @@ -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
Expand All @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion clippy_lints/src/escape.rs
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions clippy_lints/src/eta_reduction.rs
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/identity_op.rs
Expand Up @@ -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`"
}

Expand Down
5 changes: 3 additions & 2 deletions clippy_lints/src/if_not_else.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/items_after_statements.rs
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions clippy_lints/src/len_zero.rs
Expand Up @@ -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"
}
Expand All @@ -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()`"
}

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/let_if_seq.rs
Expand Up @@ -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)]
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/loops.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/map_clone.rs
Expand Up @@ -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)]
Expand Down

0 comments on commit b91c1a5

Please sign in to comment.