Commit Graph

2109 Commits

Author SHA1 Message Date
Hidehito Yabuuchi
fa6c9f838c Minor changes on clippy_lints/src/wildcard_dependencies.rs 2018-10-24 15:00:28 +09:00
Hidehito Yabuuchi
0263ddde92 Lint for wildcard dependencies in Cargo.toml 2018-10-24 15:00:28 +09:00
bors[bot]
122da1de3b Merge #3339
3339: Check for known array length in `needless_range_loop` r=phansch a=HMPerson1

In `VarVisitor`, we now keep track of the type of the thing that was directly indexed and, if it's an array, check if the range's end is (or is past) the array's length.

Fixes  #3033

Co-authored-by: HMPerson1 <hmperson1@gmail.com>
2018-10-24 05:45:02 +00:00
Owen Sanchez
50b9e7aebc Don't emit new_without_default_derive if an impl of Default exists 2018-10-23 20:44:31 -07:00
Maxwell Anderson
b1abc81a60 small fix 2018-10-23 16:35:09 -06:00
Maxwell Anderson
6a695ffb3d added float support for mistyped literal lints 2018-10-23 15:54:27 -06:00
Maxwell Anderson
83ca8d4984 Merge remote-tracking branch 'upstream/master' 2018-10-23 15:24:05 -06:00
Guillem Nieto
fd3651a551 Fix inspector pass documentation
When using `#[clippy_dump]`, the compiler complains about an unknown
attribute. The correct one seems to be `#[clippy::dump]`.
2018-10-23 23:03:23 +02:00
Josh Mcguigan
a624583557 new_ret_no_self added test cases 2018-10-20 06:29:17 -07:00
Josh Mcguigan
079f9f45b5 new_ret_no_self walk return type to check for self 2018-10-19 17:54:25 -07:00
HMPerson1
2e9172aea2
Check for known array length in needless_range_loop 2018-10-19 16:34:16 -04:00
HMPerson1
2a9dec681f
Fix suggestion for multiple derefs 2018-10-19 14:51:25 -04:00
Josh Mcguigan
097df8f223 new_ret_no_self correct false positive on raw pointer return types 2018-10-19 05:20:33 -07:00
Josh Mcguigan
6e75050be0 new_ret_no_self correct linting of tuple return types 2018-10-19 04:55:06 -07:00
HMPerson1
a2be050965
Fix clone_on_copy not detecting derefs sometimes 2018-10-19 00:03:56 -04:00
Maxwell Anderson
9f637288cf Merge remote-tracking branch 'upstream/master' 2018-10-18 15:45:05 -06:00
Matthias Krüger
fd2f6dd382 new_ret_no_self: add sample from #3313 to Known Problems section.
fix trivial typo on the way
2018-10-18 23:37:43 +02:00
Philipp Hansch
8f5a2484a0
Merge pull request #3303 from shssoichiro/3069-unnecessary-fold-pattern-guard
Note known false positives in unnecessary_fold lint
2018-10-18 22:26:33 +02:00
Lukas Stevens
5614dcb4ea Support multiline comments and hopefully fix panic 2018-10-18 18:57:16 +02:00
Lukas Stevens
8753e568bf Check for comments in collapsible ifs 2018-10-18 18:00:21 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
1264bb6b7d
Merge pull request #3323 from pengowen123/fix_manual_memcpy
Simplify manual_memcpy suggestion in some cases
2018-10-18 09:44:24 +02:00
Philipp Hansch
adbaa85ee9
Merge pull request #3330 from shssoichiro/3309-goblin-ice
Resolve ICE in needless range loop lint
2018-10-17 21:01:15 +02:00
Joshua Holmer
4b68c965fe Resolve ICE in needless range loop lint
An ICE would occur if the needless range loop was triggered
within a procedural macro, because Clippy would try to produce
a code suggestion which was invalid, and caused the compiler
to crash.

This commit takes the same approach which Clippy currently takes
to work around this type of crash in the needless pass by value lint,
which is to skip the lint if Clippy is inside of a macro.
2018-10-17 10:43:32 -04:00
Philipp Hansch
284c63e84d
Merge pull request #3281 from CYBAI/redundant-match
Add lint for redundant pattern matching for explicit return boolean
2018-10-17 07:31:09 +02:00
CYBAI
66ae3b1249 Rename if_let_redundant_pattern_matching to redundant_pattern_matching
Also, making the old one deprecated
2018-10-17 11:20:42 +08:00
CYBAI
3b7c88888b Add lint for redundant pattern matching for explicit return boolean 2018-10-17 11:14:37 +08:00
Giorgio Gambino
aa88e68902 Fix issue #3322: reword help message for len_zero 2018-10-16 23:23:31 +02:00
Owen Sanchez
8c902d1cf2 Simplify manual_memcpy suggestion in some cases 2018-10-16 12:38:23 -07:00
Joshua Holmer
33847b579e Update known problems for unnecessary_fold 2018-10-16 09:04:02 -04:00
Bruno Kirschner
2d8b4f3d5c Avoid linting boxed_local on trait implementations. 2018-10-15 20:34:45 +02:00
Josh Mcguigan
66d3672b26 out_of_bounds_indexing improved reporting of out of bounds value 2018-10-15 04:44:39 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
0f4b13bc1b
Merge pull request #3316 from pengowen123/fix_needless_range_loop
Swap order of methods in `needless_range_loop` suggestion for efficiency in some cases
2018-10-15 09:33:21 +02:00
Owen Sanchez
456843f1cd Swap order of methods in needless_range_loop suggestion in some cases 2018-10-14 20:14:16 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
212a4fe4f4
fix for rustc master 2018-10-14 22:55:26 +02:00
Josh Mcguigan
5c39282826 out_of_bounds_indexing refactoring 2018-10-14 07:49:28 -07:00
Matthias Krüger
c492818110 mem_forget: fix syntax error in code sample 2018-10-14 10:30:04 +02:00
Josh Mcguigan
0f3345e8b2 OUT_OF_BOUNDS_INDEXING fix #3102 false negative 2018-10-13 13:51:53 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
601cc9d2c5
Merge pull request #3310 from JoshMcguigan/explicit_counter_loop-3308
explicit_counter_loop fix #3308 false positive
2018-10-13 20:11:50 +02:00
Josh Mcguigan
c6f79c7ba0 explicit_counter_loop fix #3308 false positive 2018-10-13 06:57:52 -07:00
Josh Mcguigan
54506705ce Added new_ret_no_self exception to clippy to pass dogfood tests 2018-10-13 06:25:10 -07:00
Josh Mcguigan
a5e4805ecf new_ret_no_self correctly lint impl return 2018-10-13 06:20:39 -07:00
Josh Mcguigan
2ef4af7db2 Removed unused variables 2018-10-13 06:20:39 -07:00
Josh Mcguigan
1c4fa419f3 new_ret_no_self fix false positive for impl trait return with associated type self 2018-10-13 06:20:39 -07:00
Josh Mcguigan
13ce96c4bf new_ret_no_self corrected panic and added test stderr 2018-10-13 06:20:39 -07:00
Josh Mcguigan
eb854b233c new_ret_no_self added positive test cases 2018-10-13 06:20:39 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
8b12eee112
Merge pull request #3233 from rust-lang-nursery/unused-unit
new lint: unused_unit
2018-10-13 09:30:19 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
78860a71d8
Merge pull request #3298 from devonhollowood/pedantic-dogfood-naming
Pedantic dogfood: naming and docs
2018-10-13 09:24:55 +02:00
Devon Hollowood
335bc1e820 Fix some more stutter warnings 2018-10-12 17:07:48 -07:00
Andre Bogus
e8687a6677 unused unit lint 2018-10-13 00:42:55 +02:00
Joshua Holmer
863c8e26fc Revert "Exclude pattern guards from unnecessary_fold lint"
This reverts commit d3c06f7252.
2018-10-12 13:15:55 -04:00
Joshua Holmer
d3c06f7252 Exclude pattern guards from unnecessary_fold lint
Methods like `Iterator::any` borrow the iterator mutably,
which is not allowed within a pattern guard and will fail to compile.
This commit prevents clippy from suggesting this type of change.

Closes #3069
2018-10-12 12:11:56 -04:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
d445dbfe16
Merge pull request #3291 from JoshMcguigan/cmp_owned-3289
cmp_owned wording and false positive
2018-10-12 15:07:12 +02:00
Josh Mcguigan
352863065c cmp_owned refactor 2018-10-12 04:48:54 -07:00
Josh Mcguigan
c9718fa589 cmp_owned correct error message if rhs is deref 2018-10-12 04:34:41 -07:00
sigustin
4e20625187
Add a comment reminding to update README if the default changes 2018-10-12 12:32:48 +02:00
Maxwell Anderson
63fbeaab68 Merge remote-tracking branch 'upstream/master' 2018-10-11 22:16:05 -06:00
Maxwell Anderson
9fad38dca9 tmp progress 2018-10-11 22:15:01 -06:00
Devon Hollowood
73ba33dd2b Fix doc_markdown lints 2018-10-11 15:43:13 -07:00
Devon Hollowood
dcef9d0795 Fix stutter lints 2018-10-11 15:42:22 -07:00
Devon Hollowood
9afd8abbe3 Fix similar_names warnings
Most of these are just `#![allow]`ed, because they are things like using
l vs r to differentiate left vs right. These would be made less clear by
taking the advice of `similar_names`
2018-10-11 15:18:58 -07:00
Josh Mcguigan
0b65462ca5 cmp_owned current suggestion for multiple deref 2018-10-11 05:03:02 -07:00
Oliver Scherer
9d3373137b Remove now-useless allow(unknown_lints) 2018-10-11 12:18:27 +02:00
Oliver Scherer
b8654eaa6c Stabilize tool lints 2018-10-11 12:16:22 +02:00
Philipp Hansch
8b45dd704b
Merge pull request #3294 from mikerite/fix-3276
Fix fn_to_numeric_cast_with_truncation suppression
2018-10-11 10:53:05 +02:00
Philipp Hansch
928a6d3dc7
Merge pull request #3288 from devonhollowood/pedantic-dogfood-casts
Pedantic dogfood: casts
2018-10-11 08:07:51 +02:00
Michael Wright
80cf0d7f26 Fix fn_to_numeric_cast_with_truncation suppression
Fixes #3276
2018-10-11 07:45:26 +02:00
mikerite
31eb3b73d3
Merge pull request #3127 from mikerite/fix-2937
Fix 2937
2018-10-11 06:22:02 +02:00
Karim SENHAJI
f9e4f5695d Limit commutative assign op lint to primitive types 2018-10-10 19:10:44 +02:00
Devon Hollowood
289c642d1a Clarify code
Take advantage of the fact that very large regexes are unlikely
2018-10-09 23:35:10 -07:00
Michael Wright
7499cb543d Fix #2937 2018-10-10 07:52:58 +02:00
Josh Mcguigan
88ee209a1d Corrected single-character string constant used as pattern found in dogfood test 2018-10-09 20:01:12 -07:00
Josh Mcguigan
b0d7aea946 Fixes 3289, cmp_owned wording and false positive 2018-10-09 19:25:03 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
f6882ede4d
Merge pull request #3287 from JoshMcguigan/cmp_owned-2925
cmp_owned false positive
2018-10-09 10:01:31 +02:00
Devon Hollowood
2b9abc5daa Fix cast_possible_wrap and cast_sign_loss warnings 2018-10-08 22:34:10 -07:00
Devon Hollowood
eef2e8948b Fix cast_possible_truncation warnings 2018-10-08 21:40:21 -07:00
Josh Mcguigan
ad5c29a445 Fixes #2925 cmp_owned false positive 2018-10-08 19:04:29 -07:00
Matthias Krüger
a578cb2d62 if_let_redundant_pattern_matching: use Span.to() instead of Span.with_hi() to fix crash.
Fixes #3064
2018-10-08 17:34:43 +02:00
Rotem Yaari
1ef32e4096 Improve diagnostics in case of lifetime elision (closes #3284) 2018-10-08 13:07:21 +03:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
02705d4cf5
Merge pull request #3282 from JoshMcguigan/excessive_precision-2840
Fix excessive_precision false positive
2018-10-08 08:24:13 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
ce2da2c04f
Merge pull request #3283 from etaoins/dont-suggest-cloned-for-map-box-deref
Don't suggest cloned() for map Box deref
2018-10-08 08:21:59 +02:00
Philipp Hansch
41e94dd072
Merge pull request #3285 from devonhollowood/pedantic-dogfood-items-after-statements
Pedantic dogfood: `items_after_statements`
2018-10-08 06:59:55 +01:00
Devon Hollowood
82638e4dd4 Fix items_after_statements for consts 2018-10-07 17:09:32 -07:00
Devon Hollowood
be983fbf52 Fix items_after_statements for sub-functions 2018-10-07 17:09:32 -07:00
Devon Hollowood
6528749083 Fix items_after_statements for use statements 2018-10-07 17:09:32 -07:00
Ryan Cumming
9bd4e5469e Don't suggest cloned() for map Box deref
Boxes are a bit magic in that they need to use `*` to get an owned value
out of the box. They implement `Deref` but that only returns a
reference. This means an easy way to convert an `Option<Box<T>>` to an
`<Option<T>` is:

```
box_option.map(|b| *b)
```

However, since b36bb0a6 the `map_clone` lint is detecting this as an
attempt to copy the box. Fix by excluding boxes completely from the
deref part of this lint.

Fixes #3274
2018-10-08 06:20:32 +11:00
Josh Mcguigan
8a77a25b8a Fix excessive_precision false positive 2018-10-07 11:38:20 -07:00
Philipp Hansch
63ceabf0cf
Merge pull request #3280 from d-dorazio/fix-new_without_default-should-not-fire-unsafe-new
new_without_default should not warn about unsafe new
2018-10-07 13:09:37 +01:00
Manish Goregaokar
5dcb90e29d
Merge pull request #3279 from phansch/fix_fp_in_fn_to_numeric_cast_with_truncation
Fix FP in `fn_to_numeric_cast_with_truncation`
2018-10-07 04:27:51 -07:00
Philipp Hansch
d365742bc6
Fix FP in fn_to_numeric_cast_with_truncation
We only want this lint to check casts to numeric, as per the lint title.
Rust already has a built-in check for all other casts
[here][rust_check].

[rust_check]: 5472b0718f/src/librustc_typeck/check/cast.rs (L430-L433)
2018-10-07 12:50:36 +02:00
Daniele D'Orazio
59c4ff77f1 new_without_default should not warn about unsafe new 2018-10-07 12:39:54 +02:00
Dylan Maccora
d129d049c6 Adding more detail to filter_map lint documentation. 2018-10-07 11:24:09 +11:00
Manish Goregaokar
e9c025ea70 Add license header to Rust files 2018-10-06 09:43:08 -07:00
Manish Goregaokar
53d41e5c50 Rustup for https://github.com/rust-lang/rust/pull/54741 2018-10-05 13:41:40 -07:00
Manish Goregaokar
cbde8201c5 Remove unused utils 2018-10-05 13:26:39 -07:00
Manish Goregaokar
75965030c7
Merge pull request #3251 from rust-lang-nursery/relicense-rewrite
[do not merge] Relicensing rewrite
2018-10-05 20:14:55 +02:00
Philipp Hansch
1544a1a681
Merge remote-tracking branch 'origin/master' into relicense-rewrite 2018-10-05 07:18:24 +02:00
Joel Gallant
163780ee0b Solves #3222 by checking the BareFnTy Abi type 2018-10-04 18:49:03 -06:00
Philipp Hansch
391d53db66
Add hidden lifetime parameters to fix warning 2018-10-04 21:59:30 +02:00
Philipp Hansch
c0ab8b2531
Reimplement the fn_to_numeric_cast_with_truncation lint 2018-10-04 21:44:16 +02:00
Philipp Hansch
7adf24ebb0
Improve docs of fn_to_numeric_cast
Closes #2980
2018-10-04 18:09:09 +02:00
Matthias Krüger
fd5ea0ddf7 resolve build warnings in clippy_lints/src/format.rs 2018-10-04 16:34:41 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
c3e3be374b
Merge pull request #3256 from rust-lang-nursery/fix-2796
Fix 2796 and 3020
2018-10-04 08:51:00 +02:00
mcarton
5173ed0c03 Don't suggest to_string().to_string in USELESS_FORMAT 2018-10-03 20:59:59 +02:00
Philipp Hansch
f42272102a
Reimplement the fn_to_numeric_cast lint 2018-10-03 12:02:06 +02:00
Manish Goregaokar
c430147942 Fix push_item_path call (rustup to 4cf11765dc) 2018-10-03 02:06:26 -07:00
mcarton
7eebd5b20c Ignore format! with precision in USELESS_FORMAT 2018-10-02 23:57:22 +02:00
Oliver Schneider
913a5c9b56 Trailing newline 2018-10-02 15:18:56 +02:00
Oliver Schneider
696dc369df FIx dogfood 2018-10-02 15:17:56 +02:00
Oliver Schneider
b36bb0a68d Reimplement the map_clone lint from scratch 2018-10-02 15:13:43 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
11cc8472a9
Merge pull request #3245 from JoshMcguigan/wrong_self_convention-1530
Correct false positive in wrong_self_convention lint for to_mut
2018-10-02 14:54:36 +02:00
Josh Mcguigan
f142098474 Correct false positive in wrong_self_convention lint for to_mut 2018-10-02 04:47:38 -07:00
Manish Goregaokar
057243f16b relicensing: Remove map_clone
This removes the code added in https://github.com/rust-lang-nursery/rust-clippy/pull/427
2018-10-02 12:51:38 +02:00
Manish Goregaokar
fffcd093b2 relicensing: Remove fn_to_numeric_cast, fn_to_numeric_cast_with_truncation
This removes the code added in https://github.com/rust-lang-nursery/rust-clippy/pull/2814
2018-10-02 12:49:27 +02:00
Manish Goregaokar
be1094bd8d ScalarMaybeUndef -> Scalar (Rustup to e812ca472a) 2018-10-02 10:35:26 +02:00
Philipp Hansch
eb5f146f14
Fix 'impossible case reached' ICE 2018-10-01 22:34:52 +02:00
Matthias Krüger
91f7e22edf remove cargo edition 2018 feature gate.
Rust and the cargo used to bootstrap was updated in https://github.com/rust-lang/rust/pull/54601 which now has the 2018 edition stabilized.
2018-09-30 11:12:24 +02:00
Michael Wright
50133fbd3a Merge branch 'master' into unnecessary_filter_map 2018-09-30 06:39:56 +02:00
Josh Mcguigan
e25f884e6f Fixes #3180, suppress excessive_precision lint for floats with no decimal part 2018-09-29 07:39:30 -07:00
Michael Wright
c2ee9c29ab Merge branch 'master' into unnecessary_filter_map 2018-09-29 15:27:47 +02:00
Michael Wright
06f6b36025 rustfmt 2018-09-29 14:18:50 +02:00
Michael Wright
efdc739dfc Move unnecessary_filter_map to a submodule 2018-09-29 14:12:40 +02:00
Philipp Krones
67d85bc47d
Merge pull request #3224 from matthiaskrgr/clippy_self__use_self
fix some clippy::pedantic warnings found in the codebase.
2018-09-28 15:26:50 +02:00
Philipp Hansch
8e808664fa
Merge pull request #3178 from ms2300/bad_unwrap
Fix for bad get unwrap suggestion
2018-09-28 07:38:00 +01:00
Michael Wright
4b4d758ce0 Fix warnings in clippy_lints 2018-09-27 06:29:48 +02:00
Michael Wright
2f364d9ac5 Merge branch 'master' into unnecessary_filter_map 2018-09-27 06:12:01 +02:00
Matthias Krüger
9fae4693f9 fix clippy::single-match-else and clippy::match_same_arms warnings in clippys codebase 2018-09-26 22:25:01 +02:00
Matthias Krüger
2a31937cc9 fix all clippy::use_self pedantic warnings found in the codebase.
cc #3172
2018-09-26 22:24:18 +02:00
Matthias Krüger
fc35c20a0a rustup
fix breakage by https://github.com/rust-lang/rust/pull/53824

use smallvec crate instead of rustcs type alias.
2018-09-26 15:57:38 +02:00
Michael Wright
f5ffac4fce Implement unnecesary_filter_map lint 2018-09-26 06:52:36 +02:00
Jane Lusby
14feb3670f Lint for chaining flatten after map
This change adds a lint to check for instances of `map(..).flatten()`
that can be trivially shortened to `flat_map(..)`

Closes #3196
2018-09-24 14:29:16 -07:00
Michael Wright
ab71f08663 Fix single_char_pattern crash (#3204)
This commit fixes the crash by removing constant checking from the lint.

Closes #3204.
2018-09-24 08:33:57 +02:00
ms2300
523ba2a009 Full fix of get unwrap issue 2018-09-23 19:53:25 -07:00
ms2300
de8d233b06 #3006 : Fixing for .get().unwrap().foo() 2018-09-23 19:53:25 -07:00
Philipp Krones
bc6d85ceaf
Merge pull request #3207 from mikerite/fix-3206
Fix double_parens false positive
2018-09-23 18:24:27 +02:00
Philipp Krones
af2d6a0c14
Merge pull request #3191 from vi/suggest_with_applicability
Use span_suggestion_with_applicability instead of span_suggestion
2018-09-23 15:45:55 +02:00
Michael Wright
867ac98d38 Fix double_parens false positive
Closes #3206
2018-09-22 17:20:34 +02:00
flip1995
987b34d090
Another Applicability adjustment 2018-09-20 14:38:48 +02:00
Vitaly _Vi Shukela
52fb7d461e
Applicability adjustment per additional comments 2018-09-20 14:38:48 +02:00
Vitaly _Vi Shukela
58729346be
Fill in Applicability from review comments by @flip1995 2018-09-20 14:38:48 +02:00
Vitaly _Vi Shukela
3eccccb367
Fix indents 2018-09-20 14:38:48 +02:00
Vitaly _Vi Shukela
2781cac839
Apply subset of "cargo fmt". 2018-09-20 14:38:47 +02:00
Vitaly _Vi Shukela
3e853a632e
Add forgotten function: span_suggestion*s* to the previous refactoting 2018-09-20 14:38:47 +02:00
Vitaly _Vi Shukela
d4c994e670
Supplement DiagnosticBuilderExt with Applicability 2018-09-20 14:38:47 +02:00
Vitaly _Vi Shukela
92034e20c8
Use span_suggestion_with_applicability instead of span_suggestion 2018-09-20 14:38:47 +02:00
Jay Kickliter
79cda3bb1e mem_replace: fix grammar. 2018-09-19 14:54:38 -07:00
Jay Kickliter
2f53aaa5bd mem_replace: match on path. 2018-09-19 14:41:22 -07:00
Jay Kickliter
12c7bc1e58 mem_replace: apply update_lints tool. 2018-09-19 14:41:22 -07:00
Jay Kickliter
1b6d739ce3 mem_replace: make examples compilable. 2018-09-19 14:38:34 -07:00
Jay Kickliter
598df08d88 Add lint for mem::replace(.., None).
Suggest `Option::take()` as an alternative.
2018-09-19 14:38:34 -07:00
Philipp Hansch
b6707ffc42
Merge pull request #3187 from flip1995/internal_fn
New internal lint: compiler_lint_functions
2018-09-19 19:43:48 +01:00
flip1995
a8b681cc2c
Fix c_void path
This got changed in rust-lang/rust#53910
2018-09-17 11:20:27 +02:00
Michael Wright
c78cf042ff Remove unneeded check for method call
The check can be removed because the call to `method_chains_args`
already performs this check.
2018-09-16 13:08:00 +02:00
flip1995
021748eb6a
Replace another occurrence of "".to_owned() 2018-09-15 11:25:40 +02:00
Matthias Krüger
f3add4acb4
convert "".to_string() and "".to_owned() to String::new() 2018-09-15 11:20:35 +02:00
flip1995
144281c537
Formatting 2018-09-15 11:02:00 +02:00
flip1995
a4e1a90705
Fix warnings of compiler_lint_functions 2018-09-15 11:02:00 +02:00
flip1995
aaeeaa5330
Add internal lint compiler_lint_functions 2018-09-15 11:01:16 +02:00
Eduard-Mihai Burtescu
c70bfb2cac Revert "the cargo feature: edition 2018 is stabilized in current nightly"
This reverts commit 404a09d61c.
2018-09-15 11:16:45 +03:00
Eduard-Mihai Burtescu
85caaf5905 Fix useless_attribute to also whitelist unused_extern_crates. 2018-09-15 11:16:45 +03:00
Eduard-Mihai Burtescu
9219fc6c5c Reintroduce extern crate for non-Cargo dependencies. 2018-09-15 11:10:51 +03:00
Philipp Hansch
4aaef72fa0
Merge pull request #3186 from flip1995/pedantic_filter_map
Fix pedantic filter_map warnings
2018-09-14 19:47:50 +01:00
flip1995
582ab5a0d0
Reapply: "the cargo feature: edition 2018 is stabilized in current nightly"
This reapplies commit 404a09d.

Cargo got bumped in rust-lang/rust#54210
2018-09-14 13:43:20 +02:00
flip1995
f49f133cba
Fix pedantic filter_map warnings 2018-09-14 12:56:25 +02:00
Manish Goregaokar
7b530c79b2 Add match on StructCtor 2018-09-14 12:41:20 +05:30
Philipp Hansch
dac5e2d3a5
Merge pull request #3140 from matthiaskrgr/redundant_casts
fix warnings about trivial casts, mostly {i,u}128 -> {i,u}128, such as "i128::min_value() as i128"
2018-09-13 20:37:13 +01:00
Philipp Hansch
07cb45bc85
Merge pull request #3166 from flip1995/travis_internal
Run internal lints on the Clippy code base
2018-09-13 17:22:48 +01:00
Matthias Krüger
28424ecbfa fix warnings about trivial casts, mostly {i,u}128 -> {i,u}128, such as "i128::min_value() as i128" 2018-09-13 07:59:12 +02:00
Philipp Hansch
e8400061bd
Merge pull request #3085 from mikerite/revert-98dbce
Revert "Fix E0502 warnings"
2018-09-13 06:33:26 +01:00
Boyu Yang
4827ab978e
Remove a wrong suggestion. 2018-09-13 13:01:23 +08:00
Boyu Yang
60e8da1647
Fix typo in examples. 2018-09-13 11:51:58 +08:00
flip1995
e28440d2e0
Change Hash{Map, Set} to FxHash{Map, Set} 2018-09-12 01:34:52 +02:00
flip1995
cfa3c33b1d
Fix lint_without_lint_pass lint 2018-09-12 01:34:04 +02:00
Oliver Schneider
1128505fdd Revert "the cargo feature: edition 2018 is stabilized in current nightly"
This reverts commit 404a09d61c.
2018-09-10 16:02:17 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
c884357849
Merge pull request #3160 from matthiaskrgr/ed_2018
the cargo feature: edition 2018 is stabilized in current nightly
2018-09-10 13:57:55 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
1c1030f83f
Merge pull request #3152 from PSeitz/master
fixes #3151 by skipping the lint instead of crashing
2018-09-10 13:44:47 +02:00
Pascal Seitz
d512c2bcce add spaces 2018-09-10 09:03:33 +02:00
Matthias Krüger
404a09d61c the cargo feature: edition 2018 is stabilized in current nightly 2018-09-10 03:01:51 +02:00
Philipp Krones
f30cf51a70
Merge pull request #3135 from JoshMcguigan/explicit_counter_loop-1219
Closes #1219 false positive for explicit_counter_loop
2018-09-09 23:49:03 +02:00
Pascal Seitz
43549ebbf8 fixes #3151 by skipping the lint instead of crashing 2018-09-08 15:30:50 +02:00
Josh Mcguigan
9168746c38 Corrected explicit_counter_loop behavior with nested loops 2018-09-07 20:46:36 -07:00
Josh Mcguigan
53c262048c Fix #1219 false positive for explicit_counter_loop 2018-09-07 19:58:19 -07:00
Matthias Krüger
f6935be71e clippy_lints: enable crate_visibility_modifier since it is used but no longer part of 2018 edition.
Fixes build with https://github.com/rust-lang/rust/pull/53999
2018-09-08 01:32:40 +02:00
flip1995
fa3e3cb6ea
Fix #3145 by removing assert 2018-09-07 17:18:00 +02:00
Josh Mcguigan
ce554267b8 Updated explicit_counter_loop tests based on discussion in #3135 2018-09-07 05:32:56 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
63a46b1e1a
Merge pull request #3129 from mipli/3091-numeric-typo
Add lint for misstyped literal casting
2018-09-07 09:54:43 +02:00
Michael A. Plikk
7bf8d8ba09 Simplified boolean expression for checking literal suffixes 2018-09-06 17:19:38 +02:00
Michael A. Plikk
986c772c24 Reduce number of split_at calls 2018-09-06 16:26:17 +02:00
Josh Mcguigan
edfa9feac2 Corrected explicit_counter_loop missing lints if variable used after loop 2018-09-06 06:20:25 -07:00
Matthias Krüger
a0f56edfc3 print_with_newline / write_with_newline: don't warn about string with several \ns in them.
Fixes #3126
2018-09-06 12:59:34 +02:00
Matthias Krüger
0a8ceaf8b0 rustfmt clippy_lints/src/write.rs 2018-09-06 12:33:00 +02:00
Matthias Krüger
554fe1ed5c remove "clippy::" lint prefix from lint name in doc url.
Fixes #3132
2018-09-06 00:45:57 +02:00
Michael A. Plikk
38d287fecd Add lint for misstyped literal casting 2018-09-05 19:46:49 +02:00
daubaris
009c29069c switched to ticks for chars 2018-09-04 18:56:48 +03:00
daubaris
db391c4613 Merge branch 'master' of https://github.com/rust-lang-nursery/rust-clippy into range-plus-one 2018-09-04 18:52:18 +03:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
b7587d8176
Merge pull request #3125 from nrc/pub-conf
Make `Default` do what `default` used to do
2018-09-04 10:09:38 +02:00
Josh Holmer
ed9cd1530d More if_chain 2018-09-03 23:58:10 -04:00
Josh Holmer
48e6be42d7 Rustup 2018-09-03 23:50:24 -04:00
Josh Holmer
061b2f3057 Apply applicability 2018-09-03 23:29:44 -04:00
Josh Holmer
dfed9751bd Majority of PR changes 2018-09-03 23:29:44 -04:00
Josh Holmer
fbc93c0166 Lint against needless uses of collect()
Handles cases of `.collect().len()`, `.collect().is_empty()`, and
`.collect().contains()`. This lint is intended to be generic enough to
be added to at a later time with other similar patterns that could be
optimized.

Closes #3034
2018-09-03 23:29:44 -04:00
Nick Cameron
4050a68989 Make Default do what default used to do 2018-09-04 09:13:48 +12:00
daubaris
2f0a99a3a4 fixed known problems expression 2018-09-03 23:01:28 +03:00
daubaris
1f3676f7d0 Merge branch 'master' of https://github.com/rust-lang-nursery/rust-clippy into range-plus-one 2018-09-03 18:24:47 +03:00
daubaris
b825578a4a backticks and testcase 2018-09-03 18:24:38 +03:00
Philipp Hansch
c0513097ab
Merge pull request #3092 from illicitonion/issue-2879
default_trait_access skips <F as Default>::default()
2018-09-03 17:24:33 +02:00
daubaris
1615a8a2b6 Merge branch 'master' of https://github.com/rust-lang-nursery/rust-clippy into range-plus-one 2018-09-03 17:21:13 +03:00
Josh Triplett
779988303a iter conservation efforts: save the endangered .iter() and .into_iter()
Make explicit_iter_loop and explicit_into_iter_loop allow-by-default, so
that people can turn them on if they want to enforce that style; avoid
presenting them as *the* idiomatic Rust style, rather than just *a* style.
2018-09-03 01:24:46 -07:00
Nick Cameron
d6f01f3a6c Make Conf::default available
Fixes RLS
2018-09-03 13:57:50 +12:00
Daniel Wagner-Hall
9f0216d520 Merge branch 'master' into issue-2879 2018-09-03 00:01:57 +01:00
Daniel Wagner-Hall
939d842ea1 Simplify 2018-09-02 23:42:07 +01:00
Daniel Wagner-Hall
368223a341 Use types rather than strings 2018-09-02 23:37:28 +01:00
Michael Wright
19157c02cb Fix #3112 2018-09-02 09:38:25 +02:00
daubaris
846c3dba2c resolved conflicts 2018-09-01 09:37:42 +03:00
Manish Goregaokar
c81d70e6bd
Merge pull request #2977 from flip1995/tool_lints
Implement tool_lints
2018-09-01 11:22:23 +05:30
Manish Goregaokar
20dfaf7842 declare_lint -> declare_tool_lint 2018-08-31 00:34:48 -07:00
Oliver Schneider
73e8416df3
Merge pull request #3081 from mikerite/fix-3078
Fix #3078
2018-08-31 09:05:39 +02:00
Michael Wright
c6074a94b9 Merge branch 'master' into fix-3078 2018-08-31 06:17:11 +02:00
Michael Wright
daacac6b97 Revert "fix-3078: verify test case"
This reverts commit 6256ad05ba.
2018-08-31 06:15:55 +02:00
daubaris
679bc32f46 range_plus_one suggestion should not remove braces fix 2018-08-30 20:06:13 +03:00
Philipp Hansch
b87ab5ccf2
Merge pull request #3076 from mbrubeck/patch-1
Remove incorrect note from string_add_assign docs
2018-08-29 20:09:38 +01:00
Manish Goregaokar
e0ad732226
Merge pull request #3105 from frewsxcv/frewsxcv-private
Make clippy_lints::{utils,consts} modules private, remove unused items.
2018-08-29 11:24:00 -07:00
flip1995
daa4f0ad34 Implement backwards compatibility changes introduced by rust-lang/rust#53762 2018-08-29 11:08:29 -07:00
flip1995
d1f2f0c34c Fix some rebase fallout 2018-08-29 11:08:29 -07:00
flip1995
f3bb161f0e Adapt codebase to the tool_lints 2018-08-29 11:08:29 -07:00
flip1995
8c07772dbb Switch to declare_tool_lint macro 2018-08-29 11:08:29 -07:00
flip1995
392235d6e1 Switch to tool_lints 2018-08-29 11:08:29 -07:00
Corey Farwell
f42442b6e0 dont deref 2018-08-29 09:07:09 -05:00
Corey Farwell
53928d5367 clippy suggestion 2018-08-29 08:27:32 -05:00
Corey Farwell
6445a5d79d derive copy/clone 2018-08-29 08:01:05 -05:00
Corey Farwell
d5534ca9db bring back sugg::range 2018-08-29 07:46:03 -05:00
Corey Farwell
9a8f206662 eof newline 2018-08-29 07:43:40 -05:00
Corey Farwell
2a486528ee utilize carrier 2018-08-29 07:42:43 -05:00
Corey Farwell
2fa7351c1e suggest wrapping_offset as well 2018-08-29 07:40:00 -05:00
Corey Farwell
61c20c148e if no suggestion, dont add suggestion 2018-08-29 07:12:22 -05:00
Corey Farwell
f7d1ef90a0 utilize .is_unsafe_ptr 2018-08-29 07:08:59 -05:00
Corey Farwell
a48a6ef10f utilize cx.tcx.types.usize 2018-08-29 07:07:23 -05:00
Corey Farwell
a7c1ea96c4 tweak comment 2018-08-29 07:03:50 -05:00
Corey Farwell
feb3e9fd5f switch lint from 'style' to 'complexity' 2018-08-29 07:02:26 -05:00
Corey Farwell
5ebae01c1e New lint: Suggest ptr.add([usize]) over ptr.offset([usize] as isize).
First part of #3047.
2018-08-28 23:21:29 -05:00
Corey Farwell
05f637cf88 Make clippy_lints::{utils,consts} modules private, remove unused items. 2018-08-28 21:32:20 -05:00
Oliver Schneider
d99cea0f16 Update imports and rustup 2018-08-28 13:13:42 +02:00
Daniel Wagner-Hall
350036a0c7 default_trait_access skips <F as Default>::default()
This includes the type name, so is clear, and may be necessary.

There doesn't seem to be an obviously cleaner way to pull out the
literal text of the named type here.

Fixes #2879
2018-08-27 23:22:07 +01:00
Matthias Krüger
fc31dc01de docs: make example in new_without_default lint syntax highlighted 2018-08-27 17:35:30 +02:00
Philipp Krones
9ce826ade1
Merge pull request #3082 from mikerite/move-range-lints
Move some range lints to complexity
2018-08-26 15:08:21 +02:00
Michael Wright
95fedd2273 Revert "Fix E0502 warnings"
This reverts commit 98dbce4fe4.

The compiler no longer emits the warnings in #2982 with the original
code.
2018-08-26 11:21:22 +02:00
Michael Wright
eef3ffab35 Remove iterator_find_map feature attribute
Closes #3083
2018-08-26 11:11:47 +02:00
Michael Wright
cc87dc7539 Move some range lints to complexity
Recategorize `range_plus_one` and `range_minus_one` to `complexity`.
This moves `range_plus_one` out of the nursery as the inclusive range
syntax is now stable. Both are moved to `complexity` as it is more
consistent with other lints such as `int_plus_one`.
2018-08-26 10:57:04 +02:00
Michael Wright
6256ad05ba fix-3078: verify test case
Check the crash test case by commenting out the fix
2018-08-25 22:35:06 +02:00
Michael Wright
45ceecc79c Fix #3078 2018-08-25 14:49:56 +02:00
Philipp Hansch
296b79bdb8
Merge pull request #3079 from matthiaskrgr/update_cargo_metadata
deps: update cargo_metadata from 0.5 to 0.6.
2018-08-24 20:09:50 +02:00