Manish Goregaokar
b2f4550654
Fix type complexity lint
2015-10-15 19:55:14 +05:30
Andre Bogus
be66322886
workaround for failing test
2015-10-15 16:18:40 +02:00
Andre Bogus
cf1e83b6dc
Merged #365
2015-10-14 12:22:57 +02:00
Andre Bogus
949c3545ce
Merged #366
2015-10-14 12:06:28 +02: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
Manish Goregaokar
567d5a7293
Improve cmp_owned suggestions ( fixes #386 )
2015-10-13 04:16:05 +05:30
Ravi Shankar
fb5fdb61fa
whup the while_let_loop for ignoring expressions!
2015-10-12 19:12:59 +05:30
swgillespie
b02e80c012
implement 0.0/0.0 -> NaN lint as described in #370
...
casing of NaN
2015-10-11 19:26:23 -07:00
Manish Goregaokar
4e2b09831b
Rust upgrade to rustc 1.5.0-nightly ( 9d3e79ad3
2015-10-10)
2015-10-12 02:42:59 +05:30
Florian Hartwig
26b2733b15
Add a lint for sized integer types in a mutex
2015-10-07 22:58:34 +02:00
Pyriphlegethon
7644f8e2a1
Add "nonsensical OpenOptions" lint
2015-10-07 13:46:51 +02:00
Florian Hartwig
f8aa0431bd
Suggest using an atomic value instead of a Mutex where possible
2015-10-07 01:35:14 +02:00
Manish Goregaokar
3e475e9588
Merge pull request #354 from Pyriphlegethon/master
...
Add "unnecessary mut passed" lint
2015-10-07 04:18:02 +05:30
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
Pyriphlegethon
390168cc0f
Well, fix them again
2015-09-30 18:17:55 +02:00
Pyriphlegethon
c5ab8d62e3
Fix tests
2015-09-30 18:00:14 +02:00
Manish Goregaokar
f76f4d52c2
Fix rustup fallout: lifetimes false positives
2015-09-30 20:10:54 +05:30
Pyriphlegethon
52aee99f6d
Add test for unnecessary mut passed lint
2015-09-30 13:28:23 +02:00
Ravi Shankar
185da55263
extending while_let to warn for more statements
2015-09-29 20:26:34 +05:30
Georg Brandl
e8f875813d
all: remove trailing spaces
2015-09-28 07:11:03 +02:00
llogiq
4838e8a3b4
Merge pull request #344 from Manishearth/reflet
...
Handle let ref in toplevel_ref_arg as well
2015-09-22 09:18:45 +02:00
Manish Goregaokar
3609a2211a
Handle let ref in toplevel_ref_arg as well
2015-09-22 12:46:51 +05:30
Georg Brandl
7cc291d02e
generalize let_and_return for any block ( closes #340 )
2015-09-20 13:57:31 +02: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
Georg Brandl
e3ee87965e
ref matches: false positive with only wildcard pattern match ( fixes #335 )
2015-09-17 07:25:08 +02:00
Nathan Weston
8a5b4f19fd
Check for mutable borrow of counter variable
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
llogiq
5c5d103405
added fp test against negative .step_by(_)
2015-09-15 09:12:58 +02: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
llogiq
0e1bc74683
additional macro check + more tests
2015-09-10 08:51:14 +02:00
llogiq
4835372df5
made shadow_unrelated allow, added previous binding span note, fixed #319
2015-09-08 11:50:04 +02:00
Manish Goregaokar
0e658afc1b
Fix mut_mut false positive, make Allow ( fixes #309 )
2015-09-08 02:29:13 +05:30
Andre Bogus
b76ad366ab
fixed bad_bit_mask false positive
2015-09-06 16:09:35 +02: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
llogiq
79bf820170
added test against const lookup
2015-09-05 16:24:41 +02:00
llogiq
cd91110ec0
new lint: min_max
2015-09-05 12:46:34 +02:00
Manish Goregaokar
fb148a50b2
Add false positive checks to unicode test
2015-09-04 16:27:53 +05:30
llogiq
e11fd49b1c
Unicode lints, second attempt: Lint whole strings, help with replacement
2015-09-04 16:18:46 +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
llogiq
0c7f05dd76
check item name for eq, fixes #268
2015-09-02 10:30:11 +02:00
llogiq
0fb7d1d2d9
reporting improvements
2015-09-02 08:19:47 +02:00
Georg Brandl
5264196538
methods: try to allow value self when type is Copy ( fixes #273 )
2015-09-01 21:08:49 +02:00
Georg Brandl
1007864198
new lint: self conventions for certain method names ( fixes #267 )
2015-09-01 18:52:48 +02:00
Georg Brandl
88dd38de87
lib: add clippy_pedantic group with all Allow by default lints ( fixes #265 )
2015-09-01 18:05:28 +02:00
Manish Goregaokar
d3da9f6c81
Merge branch 'pr-260'
...
Conflicts:
src/lib.rs
2015-08-31 15:06:53 +05:30
Georg Brandl
e33bef685e
lifetimes lint: walk type bounds as well as types ( fixes #253 , again)
2015-08-31 11:26:41 +02:00
Georg Brandl
0217fb81ee
loops: fix false positives with explicit_iter_loop and references ( fixes #261 )
2015-08-31 08:29:40 +02:00
Georg Brandl
03abe275b2
new lint: unnecessary patterns (x@_ -> x)
2015-08-30 19:02:30 +02:00
Tim Neumann
ef0c933550
add precedence_negative_literal lint
2015-08-30 17:34:48 +02:00
Georg Brandl
16df79a054
new lint: using collect() to just exhaust an iterator
...
Should use a for loop instead.
2015-08-30 13:10:59 +02:00
Georg Brandl
b72ef5a173
new lint: loop-match-break, which could be while-let ( fixes #118 )
2015-08-30 12:40:39 +02:00
Georg Brandl
6461fb3308
lifetimes lint: take "where" clauses into account ( fixes #253 )
...
If a where clause is present and has lifetimes mentioned, just bail out.
2015-08-30 09:58:26 +02:00
Manish Goregaokar
193e71be61
Merge branch 'pr-228'
...
Conflicts:
README.md
src/methods.rs
2015-08-27 11:09:40 +05:30
Georg Brandl
bb552dc96f
eta_reduction: fix false positive for unsafe fns ( fixes #243 )
2015-08-26 17:09:51 +02:00
llogiq
5e341715cd
Merge pull request #240 from Manishearth/shadow_scope
...
correct scoping for shadow lints
2015-08-25 23:56:57 +02:00
llogiq
51a211503d
correct scoping for shadow lints
2015-08-25 23:48:22 +02:00
Manish Goregaokar
c9b849bdc8
Merge pull request #237 from birkenfeld/iter_fix
...
loops: use a whitelist for the "x.iter() -> &x" lint (fixes #236 )
2015-08-26 03:16:49 +05:30
Manish Goregaokar
6df102cdab
Merge pull request #238 from birkenfeld/to_string_fix
...
methods: suggest correct replacement for `to_string()` (fixes #232 )
2015-08-26 02:43:19 +05:30
llogiq
56cdd58ad2
Merge branch 'master' of https://github.com/Manishearth/rust-clippy into shadow
2015-08-25 20:09:50 +02:00
Georg Brandl
6fa34cca29
methods: suggest correct replacement for to_string()
( fixes #232 )
2015-08-25 18:39:21 +02:00
Georg Brandl
ffed5b0b23
loops: use a whitelist for the "x.iter() -> &x" lint ( fixes #236 )
2015-08-25 18:28:05 +02:00
llogiq
5225feceaa
shadowing detection
2015-08-25 13:40:26 +02:00
Georg Brandl
64cd1fc6ba
eq_op: cut back to expressions that are guaranteed side effect free
...
fixes #229
2015-08-25 12:34:37 +02:00
Georg Brandl
56e8db476c
new lint: inherent methods that should be trait impls ( fixes #218 )
2015-08-25 11:10:42 +02:00
llogiq
209e6981a3
shadowing detection
2015-08-24 16:59:02 +02:00
R.Chavignat
e80f2470b7
Merge branch 'master' into cast_iusize_improvements
2015-08-23 00:08:16 +02:00
R.Chavignat
79ef13592e
Completed the implementation of *size handling.
...
Added some more cases to the test, and implemented a new lint,
cast_possible_wrap, triggered when casting from an unsigned type to a
signed type of the same size.
2015-08-22 23:49:03 +02:00
R.Chavignat
807dab943b
Updated test case for cast lints.
...
Also improved readability and reworded the messages.
2015-08-22 22:06:58 +02:00
Georg Brandl
7580da306e
matches: special message for this case
...
match &e { &Pat1 => {}, &Pat2 => {}, ... }
(inspired by dogfood fixes)
2015-08-22 14:34:39 +02:00
Georg Brandl
017dac2301
new lint: using &Ref patterns instead of matching on *expr ( fixes #187 )
2015-08-22 14:34:39 +02:00
Georg Brandl
630bb76f96
new lint: type complexity ( fixes #93 )
...
Still very naive, but it's a start.
2015-08-22 08:57:11 +02:00
R.Chavignat
f1255d5f5d
Casts : work in progress handling *size separately
2015-08-22 02:46:22 +02:00
Georg Brandl
707e95f2e5
types: use middle::ty types instead of ast types
...
This gets rid of the match_ty_unwrap function.
2015-08-21 19:21:19 +02:00
Georg Brandl
b2df15d65a
ptr_arg improvements ( fixes #214 )
...
* do not trigger on mutable references
* use "real" type from ty, not AST type
2015-08-21 19:21:18 +02:00
llogiq
6ffe1ed337
Merge pull request #212 from Manishearth/eq_op_const
...
Eq op const
2015-08-21 12:30:53 +02:00
llogiq
a22b3cdcee
const folding for eq_op
2015-08-21 12:26:03 +02:00
R.Chavignat
ad0bc66402
Added support for isize/usize in the CastPass lint pass.
...
Extracted the match that determines an integer types's size in a
utility function and implemented support for usize/isize.
Added a needed feature to the crate root.
Added some tests to cover those cases, and a test I previously forgot.
Silenced two errors signaled by dogfood.sh in unicode.rs.
2015-08-21 03:03:37 +02:00
R.Chavignat
dbc9b7f46e
Reworked the error messages for more heplfulness.
...
Renamed the cast_possible_overflow lint to cast_possible_truncation,
and updated the error message, readme and crate root accordingly.
Added some more information to the message for the cast_precision_loss
lint.
Updated the test case to reflect changes.
2015-08-20 22:44:40 +02:00
R.Chavignat
993239d33a
Initial implementation of lossy cast lints.
...
Introduces 3 lints :
cast_possible_overflow
cast_precision_loss
cast_sign_loss
Add a compile-test test case.
Fix errors spotted by dogfood script.
2015-08-20 01:04:06 +02:00
llogiq
98d24b5b56
fixed #203 and #197
2015-08-19 09:39:03 +02:00
Georg Brandl
8f4499f3ae
new lint: comparing unit types ( fixes #201 )
2015-08-19 08:11:00 +02:00
llogiq
0e67c0134f
make float_cmp check for zero
2015-08-17 12:08:45 +02:00
llogiq
e354fdc3e8
added regression test for #189
2015-08-17 12:08:45 +02:00
Manish Goregaokar
4f1fcd4d5b
Merge pull request #184 from Manishearth/identity_op
...
Identity op now uses const folding, no longer follows const bindings
2015-08-17 14:35:45 +05:30
Georg Brandl
e9a41e2374
new lint: lint when iterating over any Iterator::next() result ( fixes #182 )
2015-08-17 07:28:40 +02:00
llogiq
759b45a46d
made is_negative(..) public (+doctest), fixed identity_op and precedence
2015-08-16 23:09:56 +02:00
llogiq
c4b07ead17
Merge pull request #179 from nweston/step-by-zero
...
New lint: Range::step_by(0) (fixes #95 )
2015-08-16 20:12:52 +02:00
Nathan Weston
23a38c4170
New lint: Range::step_by(0) ( fixes #95 )
...
Uses type information so it can detect non-literal ranges as well
(Range or RangeFrom -- the other range types don't have step_by).
2015-08-16 12:58:54 -04:00
llogiq
e1438e7010
copied over cmp_owned fix from master
2015-08-16 16:13:44 +02:00
Manish Goregaokar
164907ece2
restrict toplevel_ref_arg to only functions ( fixes #170 )
2015-08-16 17:24:03 +05:30
Manish Goregaokar
f494f14aa6
Merge pull request #177 from birkenfeld/if_let_mini_fix
...
misc: fix check for unit body in "match -> if let" lint (fixes #172 )
2015-08-15 14:12:34 +05:30
Georg Brandl
542bf8d50e
misc: fix check for unit body in "match -> if let" lint ( fixes #172 )
2015-08-15 09:56:15 +02:00
Georg Brandl
b299433de3
lifetimes: fix case with one unnamed and one static ref ( fixes #171 )
2015-08-15 09:36:07 +02:00
llogiq
5d99ebec72
fixed false positives (at the cost of some false negatives)
2015-08-14 14:37:12 +02:00
llogiq
ffda91a8c7
removed String::from_str(..) to fix build with 1.4.0-nightly/2015-08-14
2015-08-14 14:26:57 +02:00
Manish Goregaokar
847070e19d
Merge pull request #151 from birkenfeld/needless_bool_msg
...
spelling fix, rework needless_bool with snippet (fixes #150 )
2015-08-13 23:17:18 +05:30
Manish Goregaokar
3cf5c36296
Address review comments, move to travis
2015-08-13 21:45:50 +05:30
Georg Brandl
49e51fe65a
lifetimes: try to fix w.r.t. lifetimes from parent scopes ( fixes #162 )
2015-08-13 21:45:42 +05:30
Georg Brandl
9578403638
new lint: looping over x.iter() or x.iter_mut() ( fixes #157 )
2015-08-13 16:31:16 +02:00
Georg Brandl
8a98736f51
spelling fix, rework needless_bool with snippet ( fixes #150 )
2015-08-13 15:31:16 +02:00
Andre Bogus
f67175b4cd
fixed error messages in compile-fail test
2015-08-13 11:38:39 +02:00
llogiq
f9e851e212
pulled strings passes together, added more tests
2015-08-13 11:36:39 +02:00
llogiq
0b08e9e83e
added string_add lint and fixed string_add_assign + test
2015-08-13 11:36:39 +02:00
Manish Goregaokar
8dfa02938d
Merge branch 'pr-149'
2015-08-13 13:00:29 +05:30
Manish Goregaokar
510ea0c5e5
Merge branch 'pr-140'
...
Conflicts:
src/lib.rs
2015-08-13 12:52:14 +05:30
Georg Brandl
7aee04878f
tests: use fragment of lint text for error checking
...
(Did not touch strings.rs, which is fixed by @llogiq's PR)
2015-08-13 08:12:07 +02:00
Georg Brandl
5952a29543
lifetimes test: use explicit message prefix
2015-08-13 07:51:24 +02:00
Georg Brandl
2f7693094f
lifetimes lint: include support for lifetimes as generic params
2015-08-13 06:43:25 +02:00
Georg Brandl
b349f9e88d
new lint for needless lifetimes ( fixes #115 )
2015-08-13 06:35:40 +02:00
Georg Brandl
f6090909d3
new lint: using for i in 0..x { .. vec[i] .. }
instead of iterator ( fixes #3 )
2015-08-13 06:34:08 +02:00
Georg Brandl
3044d3d633
unicode: add lint against non-ascii chars in literals (Allow by default), #85
2015-08-12 20:36:35 +02:00
Manish Goregaokar
c58f803511
Merge branch 'pr-138'
...
Conflicts:
src/lib.rs
2015-08-12 21:22:01 +05:30
Georg Brandl
4074c1f968
methods: lint against String.to_string ( fixes #100 )
2015-08-12 17:03:13 +02:00
Georg Brandl
e8fed074cf
new lint: warn if let-binding has unit value ( fixes #74 )
2015-08-12 13:21:07 +02:00
Georg Brandl
b831bd1d1d
len_zero: display full suggested expr in message
2015-08-12 10:53:14 +02:00
Georg Brandl
bcd95aec1c
all: make style of lint messages consistent
...
* start first sentence lowercased
* use backticks to delimit code snippets
* use "this is wrong. Consider doing X." consistently
2015-08-12 10:47:09 +02:00
Georg Brandl
f6dc48fe3a
new lint for "let x = EXPR; x" at the end of functions ( fixes #104 )
2015-08-11 22:25:47 +02:00
Georg Brandl
2bcc151888
new lint for Option.unwrap() and Result.unwrap()
...
The latter is set to Allow by default (fixes #24 )
2015-08-11 21:19:11 +02:00
Manish Goregaokar
6bc69fa342
Merge pull request #127 from birkenfeld/better-helptext-if-let
...
better help text for "match -> if let" lint
2015-08-12 00:44:51 +05:30
Georg Brandl
e318328d63
all: whitespace cleanup
...
* 4-space indentation
* no trailing whitespace
* no tabs
2015-08-11 20:22:50 +02:00
Manish Goregaokar
2cb26126d3
Merge branch 'pr-78'
...
Conflicts:
src/lib.rs
2015-08-11 23:28:06 +05:30
Georg Brandl
cab9905705
better help text for "match -> if let" lint
...
Implements the suggestion from #87 .
Changes span_help_and_lint(), which is only used for this lint,
to use fileline_help() instead of span_help() to avoid printing
the span twice.
Also adds complete suggested new code. I had to distinguish
between blocks, which need no additionals braces, and other exprs.
2015-08-11 19:26:51 +02:00
Georg Brandl
0ff476b529
new lint for unneeded return stmts
2015-08-11 19:05:11 +02:00
llogiq
f0eb36c2af
added parent method, also changed match-if-let note to help
2015-08-11 15:07:21 +02:00
llogiq
b393752814
New string_add_assign lint (first part of #121 ), also formatting & refactoring
2015-08-05 15:10:45 +02:00
llogiq
0e5b62c8d8
also included String::from in cmp_owned and fixed deprecation in test
2015-06-11 16:53:23 +02:00
llogiq
23caf3cccc
first unicode lint: zero_width_space
2015-06-11 11:35:00 +02:00
llogiq
1f74c4b359
removed false positives from inline_always (issue #84 )
2015-06-07 12:03:56 +02:00
llogiq
8563ee60ec
fixed issue #88 in bit_mask
2015-06-06 02:27:48 +02:00
llogiq
1ee2e4ffe8
Fixed block check, also added macro test to collapsible_if and inline_always
2015-06-01 15:09:17 +02:00
llogiq
7f5891184d
merged upstream master
2015-06-01 13:55:55 +02:00
llogiq
cdca2c93c1
now the method lookup actually works (and I understand why! 😄 ), reduces unnecessary loops, and has a few comments
2015-06-01 12:49:36 +02:00
llogiq
4c76465154
Merge pull request #68 from Manishearth/macro_expn
...
macro expn detection in mut_mut.rs
2015-06-01 07:44:27 +02:00
llogiq
21cd0c7e70
check for is_empty() method to get rid of false positives
2015-06-01 07:40:33 +02:00
Matthew Hall
423a9666ca
Implements #45 - any number mod 1 will be 0
2015-05-31 13:43:31 +01:00
llogiq
77838d6ba7
New lint for issue
...
#72
2015-05-30 15:10:19 +02:00
Matthew Hall
7e16822925
Add lint for ifs that could be collapsed
...
"Collapsible" ifs are ones which contain only a then block, and the then
block consists of an if that only has a then block.
2015-05-29 15:41:25 +01:00
llogiq
0d651c72ff
made macro test even simpler, added a few tests
2015-05-26 01:45:15 +02:00
llogiq
4292dc77a7
new lint: cmp_owned
2015-05-21 14:51:43 +02:00
llogiq
483a546e74
added messages to test error comments
2015-05-20 09:34:02 +02:00
llogiq
e8ca3c6eae
new lints len_zero and len_without_is_empty
2015-05-20 08:52:19 +02:00
llogiq
1f8453ab73
mut_mut now more robust (thanks to Manishearth, see issue #9 )
2015-05-18 10:41:15 +02:00
llogiq
96bfade4f1
New lint: mut_mut (closes issue #9 )
2015-05-18 09:02:24 +02:00
llogiq
edf747ab76
new lint: identity_op, refactored bit_masks a bit
2015-05-15 18:46:43 +02:00
llogiq
6bec4f35df
Added 'ineffective bit mask' lint
2015-05-15 14:09:29 +02:00
Manish Goregaokar
2447e1d5be
Add eta reduction ( fixes #29 )
2015-05-10 11:49:08 +05:30
llogiq
b24433f36d
added test for issue #31
2015-05-08 06:01:41 +02:00
llogiq
17bcf0e865
New lint: precedence, see issue #41
2015-05-06 12:59:08 +02:00
llogiq
ac151bb1f0
Added new 'float_cmp' lint (see issue #46 )
2015-05-06 10:01:49 +02:00
llogiq
0936e0617a
new lint to check for doomed comparisons to NAN
2015-05-04 14:11:15 +02:00
llogiq
2cb84b9d15
New lint: approx_const
2015-05-04 12:01:34 +02:00
llogiq
8d2328d9a5
Added &String matching and renamed to vec_ptr_arg to ptr_arg, also added README section
2015-05-04 08:15:24 +02:00
llogiq
07adeee6e9
Added check for zero bitmask and uncommon directions, wrong comment in needless_bool corrected, added new lint vec_ptr_arg + test
2015-05-04 07:20:34 +02:00
llogiq
53fa76dff9
new lint: needless_bool (TODO: The warnings could give more specific directions)
2015-05-02 00:35:49 +02:00
llogiq
3a9bf24bb3
Added constant lookup (with help from Manish) to bad_bit_mask
2015-04-30 15:17:06 +02:00
llogiq
441b55b328
Added eq_op and bad_bit_mask from the extra_lints project (mostly plain copy, need to refactor to integrate better)
2015-04-30 11:48:43 +02:00
Manish Goregaokar
a5c3102594
Use compiletest
2015-04-14 00:20:44 +05:30