Commit Graph

65 Commits

Author SHA1 Message Date
mcarton
34812e82d0 Use const_eval in loops 2016-02-09 21:22:30 +01:00
mcarton
83a82a1d86 Remove redundancy in lint documentation
The default level is always given in the declare_lint! macro, no need to
add it inconsistently in the documentation.
2016-02-06 00:41:54 +01:00
mcarton
13f245f6c9 Fix util/update_wiki.py warnings and be consistent in declare_lint! invocations 2016-02-06 00:13:29 +01:00
mcarton
c0063e172d Improve error message 2016-02-05 19:46:11 +01:00
mcarton
0f50b0981d Check for pattern use in FOR_KV_MAP 2016-02-05 19:14:02 +01:00
mcarton
431c446746 Lint looping on maps ignoring the keys or values 2016-02-05 19:13:14 +01:00
mcarton
db205c82a4 Add a lint about using clone on Copy types 2016-02-02 22:35:01 +01:00
mcarton
c0d2fdc723 Partially apply rustfmt 2016-02-02 22:34:20 +01:00
Oliver Schneider
3b1df8d381 fallout 2016-02-01 13:01:16 +01:00
Devon Hollowood
405d7c691e Add for_loop_over_result lint 2016-01-29 15:24:17 -08:00
Devon Hollowood
f5cc94c96a Add for_loop_over_option lint 2016-01-28 23:39:00 -08:00
Manish Goregaokar
c86a5ccd2e Upgrade Rust to rustc 1.8.0-nightly (18b851bc5 2016-01-22)
fixes #573
2016-01-22 18:35:48 +05:30
mcarton
387e0991e3 Handle more iterator adapter cases in for loops 2016-01-14 20:58:32 +01:00
Manish Goregaokar
c9342d0121 fmt clippy 2016-01-04 09:56:12 +05:30
mcarton
0c6e385493 Implement a HashMapLint 2016-01-03 17:04:08 +01:00
Johannes Linke
06f30a61dd Add "warn/allow by default" to lint descriptions where it was missing. 2016-01-01 17:48:19 +01:00
llogiq
c645a9febe adding missing doc comments 2015-12-14 22:16:56 +01:00
Oliver Schneider
cc1d696cb9 fix fallout from CC improvements 2015-12-14 14:30:09 +01:00
llogiq
5bbc1427fd added wiki comments + wiki-generating python script 2015-12-11 01:22:27 +01:00
Oliver Schneider
617c820e6b compute cyclomatic complexity (adjusted to not punish Rust's match) 2015-12-03 16:41:55 +01:00
Florian Hartwig
94dc2f567a Suppress explicit_counter_loop lint if loop variable is used after the loop 2015-11-26 00:09:01 +01:00
Florian Hartwig
9511e6739d Update to latest rust nightly 2015-11-19 15:51:30 +01:00
Seo Sanghyeon
b17e38782e Remove trailing commas in match arms with blocks 2015-11-17 13:39:42 +09:00
Florian Hartwig
5ca7ebb6d2 Fix false positives when iterator variable is used after the loop 2015-10-26 23:57:55 +01:00
Florian Hartwig
8626ac1fd4 Fixes for code review comments
* remove weird infinite loops from compile-tests
* remove call to Option::unwrap
* in the lint message, show while-let loop rewritten as for loop
2015-10-26 23:57:55 +01:00
Florian Hartwig
659e7c1d5e Don't suggest using a for loop if the iterator is used in the loop body
Due to https://github.com/rust-lang/rust/issues/8372, we have to use while-let
in these cases.
2015-10-26 23:57:55 +01:00
Florian Hartwig
f6163fce61 Suggest for loop instead of while-let when looping over iterators 2015-10-26 23:57:50 +01:00
Georg Brandl
a91c618fed Fix reverse_range_loop not taking sign into account (fixes #409)
Adds a Display impl for Constant, because that might come in handy
elsewhere as well.
2015-10-26 08:05:01 +01:00
Andre Bogus
b3d035d252 Merge PR #374 2015-10-14 11:44:09 +02:00
Andre Bogus
bed29a017b new lint to detect 2015-10-13 18:38:08 +05:30
Ravi Shankar
fb5fdb61fa whup the while_let_loop for ignoring expressions! 2015-10-12 19:12:59 +05:30
Josh Stone
846602a876 Update the DefLocal pattern
DefLocal now contains a DefId too, since rust-lang/rust@a0dc2d9a29.
2015-10-02 11:07:56 -07:00
Manish Goregaokar
431c391818 Fix a panic caused by while let 2015-10-02 13:37:41 +05:30
Manish Goregaokar
7eb0896271 Merge pull request #351 from Wafflespeanut/while_let
Training the `while_let` detector...
2015-10-01 01:14:45 +05:30
Ravi Shankar
185da55263 extending while_let to warn for more statements 2015-09-29 20:26:34 +05:30
Manish Goregaokar
15e3774cb4 rustup to 1.5.0-nightly (7bf4c885f 2015-09-26)
fixes #348
2015-09-28 10:34:10 +05:30
Pietro Monteiro
b2c66d1a0e Upgrade Rust to rustc 1.5.0-nightly (b2f379cdc 2015-09-23)
Ident was removed in many HIR structures in favor of Name.
2015-09-23 17:30:39 -07:00
Manish Goregaokar
f4da7d09d2 Upgrade Rust to rustc 1.5.0-nightly (cff041170 2015-09-17)
LintPass was split and ExprParen was removed from the HIR

Fixes #338
2015-09-19 08:23:04 +05:30
Manish Goregaokar
3124d2b8df Rustup to rustc 1.5.0-nightly (fc4d566b4 2015-09-16)
fixes #334
2015-09-17 05:32:29 +05:30
Nathan Weston
8a5b4f19fd Check for mutable borrow of counter variable 2015-09-15 09:41:25 -04:00
Nathan Weston
6b57924e81 Improve lint message
Remove trailing period and include snippet of loop argument.
2015-09-15 09:41:25 -04:00
Nathan Weston
1e320b38c1 Add is_integer_literal utility function
Replaces is_lit_zero and is_lit_one which were used in a couple of
places.
2015-09-15 09:41:25 -04:00
Nathan Weston
f87dd31f30 New lint: loop with explicit counter variable (fixes #159)
Avoiding false positives here turns out to be fairly complicated.
2015-09-15 09:41:25 -04:00
swgillespie
bc7d252856 use the constant folder to generalize the lint a little bit and clean up the code. Add additional tests for things that should not be linted 2015-09-14 22:20:56 -07:00
swgillespie
82c524b774 implement empty range lint as described in #330 2015-09-14 17:19:05 -07:00
inrustwetrust
efd553c8a9 Don't show the explicit_iter_loop lint for arrays with more than 32 elements
The IntoIterator trait is currently not implemented for arrays with more than
32 elements, so for longer arrays, the iter() or iter_mut() methods must be
used.
2015-09-06 13:36:21 +02:00
Andre Bogus
55729b7caa dogfooding a newly caught problem 2015-09-06 10:59:06 +02:00
Manish Goregaokar
eca185438b Update rust to 0efb9dab8c7c07fa28e9df0eccc5c07ea3c17fbb (HIR+lints, Thu Sep 3 18:59:56 2015 +0530)
fixes #294
2015-09-03 23:12:19 +05:30
Manish Goregaokar
73c34e12b3 Only handle ranges starting with 0 for needless_range_loop (fixes #279) 2015-09-02 16:11:54 +05:30
Georg Brandl
0217fb81ee loops: fix false positives with explicit_iter_loop and references (fixes #261) 2015-08-31 08:29:40 +02:00