Skip to content

Commit c1bbc17

Browse files
committed
Address review comments
1 parent 82e771d commit c1bbc17

15 files changed

+54
-51
lines changed

clippy_lints/src/formatting.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ declare_clippy_lint! {
6363
/// ```
6464
declare_clippy_lint! {
6565
pub POSSIBLE_MISSING_COMMA,
66-
style,
66+
correctness,
6767
"possible missing comma in array"
6868
}
6969

clippy_lints/src/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use utils::{iter_input_pats, span_lint, type_is_unsafe_function};
2424
/// ```
2525
declare_clippy_lint! {
2626
pub TOO_MANY_ARGUMENTS,
27-
style,
27+
complexity,
2828
"functions with too many arguments"
2929
}
3030

clippy_lints/src/inline_fn_without_body.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use utils::sugg::DiagnosticBuilderExt;
2222
/// ```
2323
declare_clippy_lint! {
2424
pub INLINE_FN_WITHOUT_BODY,
25-
complexity,
25+
correctness,
2626
"use of `#[inline]` on trait methods without bodies"
2727
}
2828

clippy_lints/src/lib.rs

+23-20
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ macro_rules! declare_clippy_lint {
8585
{ pub $name:tt, internal, $description:tt } => {
8686
declare_lint! { pub $name, Allow, $description }
8787
};
88+
{ pub $name:tt, internal_warn, $description:tt } => {
89+
declare_lint! { pub $name, Warn, $description }
90+
};
8891
}
8992

9093
pub mod consts;
@@ -443,7 +446,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
443446
misc::USED_UNDERSCORE_BINDING,
444447
misc_early::UNSEPARATED_LITERAL_SUFFIX,
445448
mut_mut::MUT_MUT,
446-
mutex_atomic::MUTEX_INTEGER,
447449
needless_continue::NEEDLESS_CONTINUE,
448450
non_expressive_names::SIMILAR_NAMES,
449451
replace_consts::REPLACE_CONSTS,
@@ -674,10 +676,8 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
674676
enum_variants::MODULE_INCEPTION,
675677
eq_op::OP_REF,
676678
eta_reduction::REDUNDANT_CLOSURE,
677-
formatting::POSSIBLE_MISSING_COMMA,
678679
formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
679680
formatting::SUSPICIOUS_ELSE_FORMATTING,
680-
functions::TOO_MANY_ARGUMENTS,
681681
if_let_redundant_pattern_matching::IF_LET_REDUNDANT_PATTERN_MATCHING,
682682
len_zero::LEN_WITHOUT_IS_EMPTY,
683683
len_zero::LEN_ZERO,
@@ -686,15 +686,10 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
686686
literal_representation::LARGE_DIGIT_GROUPS,
687687
literal_representation::UNREADABLE_LITERAL,
688688
loops::EMPTY_LOOP,
689-
loops::EXPLICIT_COUNTER_LOOP,
690689
loops::EXPLICIT_INTO_ITER_LOOP,
691690
loops::EXPLICIT_ITER_LOOP,
692691
loops::FOR_KV_MAP,
693-
loops::MANUAL_MEMCPY,
694692
loops::NEEDLESS_RANGE_LOOP,
695-
loops::NEVER_LOOP,
696-
loops::UNUSED_COLLECT,
697-
loops::WHILE_LET_LOOP,
698693
loops::WHILE_LET_ON_ITERATOR,
699694
map_clone::MAP_CLONE,
700695
matches::MATCH_BOOL,
@@ -703,16 +698,12 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
703698
matches::MATCH_WILD_ERR_ARM,
704699
matches::SINGLE_MATCH,
705700
methods::CHARS_LAST_CMP,
706-
methods::CHARS_NEXT_CMP,
707-
methods::FILTER_NEXT,
708701
methods::GET_UNWRAP,
709702
methods::ITER_CLONED_COLLECT,
710703
methods::ITER_SKIP_NEXT,
711704
methods::NEW_RET_NO_SELF,
712705
methods::OK_EXPECT,
713706
methods::OPTION_MAP_OR_NONE,
714-
methods::OR_FUN_CALL,
715-
methods::SEARCH_IS_SOME,
716707
methods::SHOULD_IMPLEMENT_TRAIT,
717708
methods::STRING_EXTEND_CHARS,
718709
methods::UNNECESSARY_FOLD,
@@ -724,10 +715,8 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
724715
misc_early::DOUBLE_NEG,
725716
misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
726717
misc_early::MIXED_CASE_HEX_LITERALS,
727-
misc_early::REDUNDANT_CLOSURE_CALL,
728718
misc_early::UNNEEDED_FIELD_PATTERN,
729719
mut_reference::UNNECESSARY_MUT_PASSED,
730-
needless_bool::BOOL_COMPARISON,
731720
needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
732721
neg_multiply::NEG_MULTIPLY,
733722
new_without_default::NEW_WITHOUT_DEFAULT,
@@ -763,22 +752,25 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
763752
eval_order_dependence::EVAL_ORDER_DEPENDENCE,
764753
explicit_write::EXPLICIT_WRITE,
765754
format::USELESS_FORMAT,
755+
functions::TOO_MANY_ARGUMENTS,
766756
identity_conversion::IDENTITY_CONVERSION,
767757
identity_op::IDENTITY_OP,
768-
inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
769758
int_plus_one::INT_PLUS_ONE,
770759
lifetimes::NEEDLESS_LIFETIMES,
771760
lifetimes::UNUSED_LIFETIMES,
772-
loops::FOR_LOOP_OVER_OPTION,
773-
loops::FOR_LOOP_OVER_RESULT,
774-
loops::ITER_NEXT_LOOP,
761+
loops::EXPLICIT_COUNTER_LOOP,
775762
loops::MUT_RANGE_BOUND,
763+
loops::WHILE_LET_LOOP,
776764
matches::MATCH_AS_REF,
765+
methods::CHARS_NEXT_CMP,
777766
methods::CLONE_ON_COPY,
767+
methods::FILTER_NEXT,
768+
methods::SEARCH_IS_SOME,
778769
methods::USELESS_ASREF,
779-
misc::FLOAT_CMP,
780770
misc::SHORT_CIRCUIT_STATEMENT,
771+
misc_early::REDUNDANT_CLOSURE_CALL,
781772
misc_early::ZERO_PREFIXED_LITERAL,
773+
needless_bool::BOOL_COMPARISON,
782774
needless_bool::NEEDLESS_BOOL,
783775
needless_borrow::NEEDLESS_BORROW,
784776
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
@@ -801,7 +793,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
801793
transmute::TRANSMUTE_PTR_TO_REF,
802794
transmute::USELESS_TRANSMUTE,
803795
types::BORROWED_BOX,
804-
types::BOX_VEC,
805796
types::CAST_LOSSLESS,
806797
types::CHAR_LIT_AS_U8,
807798
types::OPTION_OPTION,
@@ -830,15 +821,22 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
830821
enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
831822
eq_op::EQ_OP,
832823
erasing_op::ERASING_OP,
824+
formatting::POSSIBLE_MISSING_COMMA,
833825
functions::NOT_UNSAFE_PTR_ARG_DEREF,
834826
infinite_iter::INFINITE_ITER,
827+
inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
835828
invalid_ref::INVALID_REF,
829+
loops::FOR_LOOP_OVER_OPTION,
830+
loops::FOR_LOOP_OVER_RESULT,
831+
loops::ITER_NEXT_LOOP,
832+
loops::NEVER_LOOP,
836833
loops::REVERSE_RANGE_LOOP,
837834
loops::WHILE_IMMUTABLE_CONDITION,
838835
methods::CLONE_DOUBLE_REF,
839836
methods::TEMPORARY_CSTRING_AS_PTR,
840837
minmax::MIN_MAX,
841838
misc::CMP_NAN,
839+
misc::FLOAT_CMP,
842840
misc::MODULO_ONE,
843841
open_options::NONSENSICAL_OPEN_OPTIONS,
844842
ptr::MUT_FROM_REF,
@@ -860,15 +858,20 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
860858
entry::MAP_ENTRY,
861859
escape::BOXED_LOCAL,
862860
large_enum_variant::LARGE_ENUM_VARIANT,
861+
loops::MANUAL_MEMCPY,
862+
loops::UNUSED_COLLECT,
863863
methods::ITER_NTH,
864+
methods::OR_FUN_CALL,
864865
methods::SINGLE_CHAR_PATTERN,
865866
misc::CMP_OWNED,
866867
mutex_atomic::MUTEX_ATOMIC,
868+
types::BOX_VEC,
867869
vec::USELESS_VEC,
868870
]);
869871

870872
reg.register_lint_group("clippy_nursery", vec![
871873
fallible_impl_from::FALLIBLE_IMPL_FROM,
874+
mutex_atomic::MUTEX_INTEGER,
872875
ranges::RANGE_PLUS_ONE,
873876
]);
874877
}

clippy_lints/src/loops.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use utils::paths;
4040
/// ```
4141
declare_clippy_lint! {
4242
pub MANUAL_MEMCPY,
43-
style,
43+
perf,
4444
"manually copying items between slices"
4545
}
4646

@@ -119,7 +119,7 @@ declare_clippy_lint! {
119119
/// ```
120120
declare_clippy_lint! {
121121
pub ITER_NEXT_LOOP,
122-
complexity,
122+
correctness,
123123
"for-looping over `_.next()` which is probably not intended"
124124
}
125125

@@ -141,7 +141,7 @@ declare_clippy_lint! {
141141
/// ```
142142
declare_clippy_lint! {
143143
pub FOR_LOOP_OVER_OPTION,
144-
complexity,
144+
correctness,
145145
"for-looping over an `Option`, which is more clearly expressed as an `if let`"
146146
}
147147

@@ -163,7 +163,7 @@ declare_clippy_lint! {
163163
/// ```
164164
declare_clippy_lint! {
165165
pub FOR_LOOP_OVER_RESULT,
166-
complexity,
166+
correctness,
167167
"for-looping over a `Result`, which is more clearly expressed as an `if let`"
168168
}
169169

@@ -191,7 +191,7 @@ declare_clippy_lint! {
191191
/// ```
192192
declare_clippy_lint! {
193193
pub WHILE_LET_LOOP,
194-
style,
194+
complexity,
195195
"`loop { if let { ... } else break }`, which can be written as a `while let` loop"
196196
}
197197

@@ -209,7 +209,7 @@ declare_clippy_lint! {
209209
/// ```
210210
declare_clippy_lint! {
211211
pub UNUSED_COLLECT,
212-
style,
212+
perf,
213213
"`collect()`ing an iterator without using the result; this is usually better \
214214
written as a for loop"
215215
}
@@ -252,7 +252,7 @@ declare_clippy_lint! {
252252
/// ```
253253
declare_clippy_lint! {
254254
pub EXPLICIT_COUNTER_LOOP,
255-
style,
255+
complexity,
256256
"for-looping with an explicit counter when `_.enumerate()` would do"
257257
}
258258

@@ -329,7 +329,7 @@ declare_clippy_lint! {
329329
/// ```
330330
declare_clippy_lint! {
331331
pub NEVER_LOOP,
332-
style,
332+
correctness,
333333
"any loop that will always `break` or `return`"
334334
}
335335

clippy_lints/src/methods.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ declare_clippy_lint! {
160160
/// **Why is this bad?** Readability, this can be written more concisely as
161161
/// `_.map_or(_, _)`.
162162
///
163-
/// **Known problems:** None.
163+
/// **Known problems:** The order of the arguments is not in execution order
164164
///
165165
/// **Example:**
166166
/// ```rust
@@ -178,7 +178,7 @@ declare_clippy_lint! {
178178
/// **Why is this bad?** Readability, this can be written more concisely as
179179
/// `_.map_or_else(_, _)`.
180180
///
181-
/// **Known problems:** None.
181+
/// **Known problems:** The order of the arguments is not in execution order.
182182
///
183183
/// **Example:**
184184
/// ```rust
@@ -214,7 +214,7 @@ declare_clippy_lint! {
214214
/// **Why is this bad?** Readability, this can be written more concisely as
215215
/// `_.and_then(_)`.
216216
///
217-
/// **Known problems:** None.
217+
/// **Known problems:** The order of the arguments is not in execution order.
218218
///
219219
/// **Example:**
220220
/// ```rust
@@ -240,7 +240,7 @@ declare_clippy_lint! {
240240
/// ```
241241
declare_clippy_lint! {
242242
pub FILTER_NEXT,
243-
style,
243+
complexity,
244244
"using `filter(p).next()`, which is more succinctly expressed as `.find(p)`"
245245
}
246246

@@ -278,7 +278,7 @@ declare_clippy_lint! {
278278
/// ```
279279
declare_clippy_lint! {
280280
pub SEARCH_IS_SOME,
281-
style,
281+
complexity,
282282
"using an iterator search followed by `is_some()`, which is more succinctly \
283283
expressed as a call to `any()`"
284284
}
@@ -297,7 +297,7 @@ declare_clippy_lint! {
297297
/// ```
298298
declare_clippy_lint! {
299299
pub CHARS_NEXT_CMP,
300-
style,
300+
complexity,
301301
"using `.chars().next()` to check if a string starts with a char"
302302
}
303303

@@ -325,7 +325,7 @@ declare_clippy_lint! {
325325
/// ```
326326
declare_clippy_lint! {
327327
pub OR_FUN_CALL,
328-
style,
328+
perf,
329329
"using any `*or` method with a function call, which suggests `*or_else`"
330330
}
331331

@@ -347,8 +347,8 @@ declare_clippy_lint! {
347347
}
348348

349349
/// **What it does:** Checks for usage of `.clone()` on a ref-counted pointer,
350-
/// (Rc, Arc, rc::Weak, or sync::Weak), and suggests calling Clone on
351-
/// the corresponding trait instead.
350+
/// (`Rc`, `Arc`, `rc::Weak`, or `sync::Weak`), and suggests calling Clone via unified
351+
/// function syntax instead (e.g. `Rc::clone(foo)`).
352352
///
353353
/// **Why is this bad?**: Calling '.clone()' on an Rc, Arc, or Weak
354354
/// can obscure the fact that only the pointer is being cloned, not the underlying

clippy_lints/src/misc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ declare_clippy_lint! {
7272
/// ```
7373
declare_clippy_lint! {
7474
pub FLOAT_CMP,
75-
complexity,
75+
correctness,
7676
"using `==` or `!=` on float values instead of comparing difference with an epsilon"
7777
}
7878

clippy_lints/src/misc_early.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ declare_clippy_lint! {
5454
/// ```
5555
declare_clippy_lint! {
5656
pub REDUNDANT_CLOSURE_CALL,
57-
style,
57+
complexity,
5858
"throwaway closures called in the expression they are defined"
5959
}
6060

clippy_lints/src/mutex_atomic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ declare_clippy_lint! {
4444
/// ```
4545
declare_clippy_lint! {
4646
pub MUTEX_INTEGER,
47-
pedantic,
47+
nursery,
4848
"using a mutex for an integer type"
4949
}
5050

clippy_lints/src/needless_bool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ declare_clippy_lint! {
4444
/// ```
4545
declare_clippy_lint! {
4646
pub BOOL_COMPARISON,
47-
style,
47+
complexity,
4848
"comparing a variable to a boolean, e.g. `if x == true`"
4949
}
5050

clippy_lints/src/print.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use syntax_pos::Span;
88
use utils::{is_expn_of, match_def_path, match_path, resolve_node, span_lint, span_lint_and_sugg};
99
use utils::{opt_def_id, paths};
1010

11-
/// **What it does:** This lint warns when you using `println!("")` to
11+
/// **What it does:** This lint warns when you use `println!("")` to
1212
/// print a newline.
1313
///
1414
/// **Why is this bad?** You should use `println!()`, which is simpler.
@@ -22,10 +22,10 @@ use utils::{opt_def_id, paths};
2222
declare_clippy_lint! {
2323
pub PRINTLN_EMPTY_STRING,
2424
style,
25-
"using `print!()` with a format string that ends in a newline"
25+
"using `println!(\"\")` with an empty string"
2626
}
2727

28-
/// **What it does:** This lint warns when you using `print!()` with a format
28+
/// **What it does:** This lint warns when you use `print!()` with a format
2929
/// string that
3030
/// ends in a newline.
3131
///

clippy_lints/src/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub struct TypePass;
4646
/// ```
4747
declare_clippy_lint! {
4848
pub BOX_VEC,
49-
complexity,
49+
perf,
5050
"usage of `Box<Vec<T>>`, vector elements are already on the heap"
5151
}
5252

0 commit comments

Comments
 (0)