Address review comments
This commit is contained in:
parent
82e771d7dc
commit
c1bbc173da
@ -63,7 +63,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub POSSIBLE_MISSING_COMMA,
|
||||
style,
|
||||
correctness,
|
||||
"possible missing comma in array"
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ use utils::{iter_input_pats, span_lint, type_is_unsafe_function};
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub TOO_MANY_ARGUMENTS,
|
||||
style,
|
||||
complexity,
|
||||
"functions with too many arguments"
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ use utils::sugg::DiagnosticBuilderExt;
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub INLINE_FN_WITHOUT_BODY,
|
||||
complexity,
|
||||
correctness,
|
||||
"use of `#[inline]` on trait methods without bodies"
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,9 @@ macro_rules! declare_clippy_lint {
|
||||
{ pub $name:tt, internal, $description:tt } => {
|
||||
declare_lint! { pub $name, Allow, $description }
|
||||
};
|
||||
{ pub $name:tt, internal_warn, $description:tt } => {
|
||||
declare_lint! { pub $name, Warn, $description }
|
||||
};
|
||||
}
|
||||
|
||||
pub mod consts;
|
||||
@ -443,7 +446,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||
misc::USED_UNDERSCORE_BINDING,
|
||||
misc_early::UNSEPARATED_LITERAL_SUFFIX,
|
||||
mut_mut::MUT_MUT,
|
||||
mutex_atomic::MUTEX_INTEGER,
|
||||
needless_continue::NEEDLESS_CONTINUE,
|
||||
non_expressive_names::SIMILAR_NAMES,
|
||||
replace_consts::REPLACE_CONSTS,
|
||||
@ -674,10 +676,8 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||
enum_variants::MODULE_INCEPTION,
|
||||
eq_op::OP_REF,
|
||||
eta_reduction::REDUNDANT_CLOSURE,
|
||||
formatting::POSSIBLE_MISSING_COMMA,
|
||||
formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
|
||||
formatting::SUSPICIOUS_ELSE_FORMATTING,
|
||||
functions::TOO_MANY_ARGUMENTS,
|
||||
if_let_redundant_pattern_matching::IF_LET_REDUNDANT_PATTERN_MATCHING,
|
||||
len_zero::LEN_WITHOUT_IS_EMPTY,
|
||||
len_zero::LEN_ZERO,
|
||||
@ -686,15 +686,10 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||
literal_representation::LARGE_DIGIT_GROUPS,
|
||||
literal_representation::UNREADABLE_LITERAL,
|
||||
loops::EMPTY_LOOP,
|
||||
loops::EXPLICIT_COUNTER_LOOP,
|
||||
loops::EXPLICIT_INTO_ITER_LOOP,
|
||||
loops::EXPLICIT_ITER_LOOP,
|
||||
loops::FOR_KV_MAP,
|
||||
loops::MANUAL_MEMCPY,
|
||||
loops::NEEDLESS_RANGE_LOOP,
|
||||
loops::NEVER_LOOP,
|
||||
loops::UNUSED_COLLECT,
|
||||
loops::WHILE_LET_LOOP,
|
||||
loops::WHILE_LET_ON_ITERATOR,
|
||||
map_clone::MAP_CLONE,
|
||||
matches::MATCH_BOOL,
|
||||
@ -703,16 +698,12 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||
matches::MATCH_WILD_ERR_ARM,
|
||||
matches::SINGLE_MATCH,
|
||||
methods::CHARS_LAST_CMP,
|
||||
methods::CHARS_NEXT_CMP,
|
||||
methods::FILTER_NEXT,
|
||||
methods::GET_UNWRAP,
|
||||
methods::ITER_CLONED_COLLECT,
|
||||
methods::ITER_SKIP_NEXT,
|
||||
methods::NEW_RET_NO_SELF,
|
||||
methods::OK_EXPECT,
|
||||
methods::OPTION_MAP_OR_NONE,
|
||||
methods::OR_FUN_CALL,
|
||||
methods::SEARCH_IS_SOME,
|
||||
methods::SHOULD_IMPLEMENT_TRAIT,
|
||||
methods::STRING_EXTEND_CHARS,
|
||||
methods::UNNECESSARY_FOLD,
|
||||
@ -724,10 +715,8 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||
misc_early::DOUBLE_NEG,
|
||||
misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
|
||||
misc_early::MIXED_CASE_HEX_LITERALS,
|
||||
misc_early::REDUNDANT_CLOSURE_CALL,
|
||||
misc_early::UNNEEDED_FIELD_PATTERN,
|
||||
mut_reference::UNNECESSARY_MUT_PASSED,
|
||||
needless_bool::BOOL_COMPARISON,
|
||||
needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
|
||||
neg_multiply::NEG_MULTIPLY,
|
||||
new_without_default::NEW_WITHOUT_DEFAULT,
|
||||
@ -763,22 +752,25 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||
eval_order_dependence::EVAL_ORDER_DEPENDENCE,
|
||||
explicit_write::EXPLICIT_WRITE,
|
||||
format::USELESS_FORMAT,
|
||||
functions::TOO_MANY_ARGUMENTS,
|
||||
identity_conversion::IDENTITY_CONVERSION,
|
||||
identity_op::IDENTITY_OP,
|
||||
inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
|
||||
int_plus_one::INT_PLUS_ONE,
|
||||
lifetimes::NEEDLESS_LIFETIMES,
|
||||
lifetimes::UNUSED_LIFETIMES,
|
||||
loops::FOR_LOOP_OVER_OPTION,
|
||||
loops::FOR_LOOP_OVER_RESULT,
|
||||
loops::ITER_NEXT_LOOP,
|
||||
loops::EXPLICIT_COUNTER_LOOP,
|
||||
loops::MUT_RANGE_BOUND,
|
||||
loops::WHILE_LET_LOOP,
|
||||
matches::MATCH_AS_REF,
|
||||
methods::CHARS_NEXT_CMP,
|
||||
methods::CLONE_ON_COPY,
|
||||
methods::FILTER_NEXT,
|
||||
methods::SEARCH_IS_SOME,
|
||||
methods::USELESS_ASREF,
|
||||
misc::FLOAT_CMP,
|
||||
misc::SHORT_CIRCUIT_STATEMENT,
|
||||
misc_early::REDUNDANT_CLOSURE_CALL,
|
||||
misc_early::ZERO_PREFIXED_LITERAL,
|
||||
needless_bool::BOOL_COMPARISON,
|
||||
needless_bool::NEEDLESS_BOOL,
|
||||
needless_borrow::NEEDLESS_BORROW,
|
||||
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
|
||||
@ -801,7 +793,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||
transmute::TRANSMUTE_PTR_TO_REF,
|
||||
transmute::USELESS_TRANSMUTE,
|
||||
types::BORROWED_BOX,
|
||||
types::BOX_VEC,
|
||||
types::CAST_LOSSLESS,
|
||||
types::CHAR_LIT_AS_U8,
|
||||
types::OPTION_OPTION,
|
||||
@ -830,15 +821,22 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||
enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
|
||||
eq_op::EQ_OP,
|
||||
erasing_op::ERASING_OP,
|
||||
formatting::POSSIBLE_MISSING_COMMA,
|
||||
functions::NOT_UNSAFE_PTR_ARG_DEREF,
|
||||
infinite_iter::INFINITE_ITER,
|
||||
inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
|
||||
invalid_ref::INVALID_REF,
|
||||
loops::FOR_LOOP_OVER_OPTION,
|
||||
loops::FOR_LOOP_OVER_RESULT,
|
||||
loops::ITER_NEXT_LOOP,
|
||||
loops::NEVER_LOOP,
|
||||
loops::REVERSE_RANGE_LOOP,
|
||||
loops::WHILE_IMMUTABLE_CONDITION,
|
||||
methods::CLONE_DOUBLE_REF,
|
||||
methods::TEMPORARY_CSTRING_AS_PTR,
|
||||
minmax::MIN_MAX,
|
||||
misc::CMP_NAN,
|
||||
misc::FLOAT_CMP,
|
||||
misc::MODULO_ONE,
|
||||
open_options::NONSENSICAL_OPEN_OPTIONS,
|
||||
ptr::MUT_FROM_REF,
|
||||
@ -860,15 +858,20 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||
entry::MAP_ENTRY,
|
||||
escape::BOXED_LOCAL,
|
||||
large_enum_variant::LARGE_ENUM_VARIANT,
|
||||
loops::MANUAL_MEMCPY,
|
||||
loops::UNUSED_COLLECT,
|
||||
methods::ITER_NTH,
|
||||
methods::OR_FUN_CALL,
|
||||
methods::SINGLE_CHAR_PATTERN,
|
||||
misc::CMP_OWNED,
|
||||
mutex_atomic::MUTEX_ATOMIC,
|
||||
types::BOX_VEC,
|
||||
vec::USELESS_VEC,
|
||||
]);
|
||||
|
||||
reg.register_lint_group("clippy_nursery", vec![
|
||||
fallible_impl_from::FALLIBLE_IMPL_FROM,
|
||||
mutex_atomic::MUTEX_INTEGER,
|
||||
ranges::RANGE_PLUS_ONE,
|
||||
]);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ use utils::paths;
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub MANUAL_MEMCPY,
|
||||
style,
|
||||
perf,
|
||||
"manually copying items between slices"
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub ITER_NEXT_LOOP,
|
||||
complexity,
|
||||
correctness,
|
||||
"for-looping over `_.next()` which is probably not intended"
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub FOR_LOOP_OVER_OPTION,
|
||||
complexity,
|
||||
correctness,
|
||||
"for-looping over an `Option`, which is more clearly expressed as an `if let`"
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub FOR_LOOP_OVER_RESULT,
|
||||
complexity,
|
||||
correctness,
|
||||
"for-looping over a `Result`, which is more clearly expressed as an `if let`"
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub WHILE_LET_LOOP,
|
||||
style,
|
||||
complexity,
|
||||
"`loop { if let { ... } else break }`, which can be written as a `while let` loop"
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub UNUSED_COLLECT,
|
||||
style,
|
||||
perf,
|
||||
"`collect()`ing an iterator without using the result; this is usually better \
|
||||
written as a for loop"
|
||||
}
|
||||
@ -252,7 +252,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub EXPLICIT_COUNTER_LOOP,
|
||||
style,
|
||||
complexity,
|
||||
"for-looping with an explicit counter when `_.enumerate()` would do"
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub NEVER_LOOP,
|
||||
style,
|
||||
correctness,
|
||||
"any loop that will always `break` or `return`"
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ declare_clippy_lint! {
|
||||
/// **Why is this bad?** Readability, this can be written more concisely as
|
||||
/// `_.map_or(_, _)`.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
/// **Known problems:** The order of the arguments is not in execution order
|
||||
///
|
||||
/// **Example:**
|
||||
/// ```rust
|
||||
@ -178,7 +178,7 @@ declare_clippy_lint! {
|
||||
/// **Why is this bad?** Readability, this can be written more concisely as
|
||||
/// `_.map_or_else(_, _)`.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
/// **Known problems:** The order of the arguments is not in execution order.
|
||||
///
|
||||
/// **Example:**
|
||||
/// ```rust
|
||||
@ -214,7 +214,7 @@ declare_clippy_lint! {
|
||||
/// **Why is this bad?** Readability, this can be written more concisely as
|
||||
/// `_.and_then(_)`.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
/// **Known problems:** The order of the arguments is not in execution order.
|
||||
///
|
||||
/// **Example:**
|
||||
/// ```rust
|
||||
@ -240,7 +240,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub FILTER_NEXT,
|
||||
style,
|
||||
complexity,
|
||||
"using `filter(p).next()`, which is more succinctly expressed as `.find(p)`"
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub SEARCH_IS_SOME,
|
||||
style,
|
||||
complexity,
|
||||
"using an iterator search followed by `is_some()`, which is more succinctly \
|
||||
expressed as a call to `any()`"
|
||||
}
|
||||
@ -297,7 +297,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub CHARS_NEXT_CMP,
|
||||
style,
|
||||
complexity,
|
||||
"using `.chars().next()` to check if a string starts with a char"
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub OR_FUN_CALL,
|
||||
style,
|
||||
perf,
|
||||
"using any `*or` method with a function call, which suggests `*or_else`"
|
||||
}
|
||||
|
||||
@ -347,8 +347,8 @@ declare_clippy_lint! {
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for usage of `.clone()` on a ref-counted pointer,
|
||||
/// (Rc, Arc, rc::Weak, or sync::Weak), and suggests calling Clone on
|
||||
/// the corresponding trait instead.
|
||||
/// (`Rc`, `Arc`, `rc::Weak`, or `sync::Weak`), and suggests calling Clone via unified
|
||||
/// function syntax instead (e.g. `Rc::clone(foo)`).
|
||||
///
|
||||
/// **Why is this bad?**: Calling '.clone()' on an Rc, Arc, or Weak
|
||||
/// can obscure the fact that only the pointer is being cloned, not the underlying
|
||||
|
@ -72,7 +72,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub FLOAT_CMP,
|
||||
complexity,
|
||||
correctness,
|
||||
"using `==` or `!=` on float values instead of comparing difference with an epsilon"
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub REDUNDANT_CLOSURE_CALL,
|
||||
style,
|
||||
complexity,
|
||||
"throwaway closures called in the expression they are defined"
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub MUTEX_INTEGER,
|
||||
pedantic,
|
||||
nursery,
|
||||
"using a mutex for an integer type"
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub BOOL_COMPARISON,
|
||||
style,
|
||||
complexity,
|
||||
"comparing a variable to a boolean, e.g. `if x == true`"
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ use syntax_pos::Span;
|
||||
use utils::{is_expn_of, match_def_path, match_path, resolve_node, span_lint, span_lint_and_sugg};
|
||||
use utils::{opt_def_id, paths};
|
||||
|
||||
/// **What it does:** This lint warns when you using `println!("")` to
|
||||
/// **What it does:** This lint warns when you use `println!("")` to
|
||||
/// print a newline.
|
||||
///
|
||||
/// **Why is this bad?** You should use `println!()`, which is simpler.
|
||||
@ -22,10 +22,10 @@ use utils::{opt_def_id, paths};
|
||||
declare_clippy_lint! {
|
||||
pub PRINTLN_EMPTY_STRING,
|
||||
style,
|
||||
"using `print!()` with a format string that ends in a newline"
|
||||
"using `println!(\"\")` with an empty string"
|
||||
}
|
||||
|
||||
/// **What it does:** This lint warns when you using `print!()` with a format
|
||||
/// **What it does:** This lint warns when you use `print!()` with a format
|
||||
/// string that
|
||||
/// ends in a newline.
|
||||
///
|
||||
|
@ -46,7 +46,7 @@ pub struct TypePass;
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub BOX_VEC,
|
||||
complexity,
|
||||
perf,
|
||||
"usage of `Box<Vec<T>>`, vector elements are already on the heap"
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ use std::collections::HashMap;
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub LINT_AUTHOR,
|
||||
style, // ok, this is not a style lint, but it's also a noop without the appropriate attribute
|
||||
internal_warn,
|
||||
"helper for writing lints"
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ use syntax::attr;
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
pub DEEP_CODE_INSPECTION,
|
||||
style, // not a style lint, but essentially a noop without the appropriate attribute
|
||||
internal_warn,
|
||||
"helper to dump info about code"
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ error: this loop never actually loops
|
||||
13 | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D never-loop` implied by `-D warnings`
|
||||
= note: #[deny(never_loop)] on by default
|
||||
|
||||
error: this loop never actually loops
|
||||
--> $DIR/never_loop.rs:28:5
|
||||
|
Loading…
x
Reference in New Issue
Block a user