Kevin Yap
70e3277bf9
Compare float literals to stringified constants
...
- Convert constants to strings and compare directly with float literal.
- Return immediately after positive match for constant.
- Fix value of `my_log10_e` in `approx_const` tests.
2015-10-24 16:00:22 -07:00
Kevin Yap
546eb14b7e
Change implementation of approx_const lint
...
- Replace epsilon with lower and upper bounds for each constant.
- Warn on use of "3.14", and update tests accordingly.
2015-10-22 23:07:27 -07:00
Seo Sanghyeon
d843257643
New lint for struct update that has no effect
2015-10-22 18:19:06 +09:00
Andre Bogus
da82e2d3ba
added code snippet help to match_bool
2015-10-21 08:24:56 +02:00
Vikas Kumar
5e78fbbf57
Fixups from review comments
...
1. Moved common check `in_external_macro` to the top of function from inside each
conditionals.
2. Inlined `is_bool_expr` call
2015-10-20 11:26:54 -07:00
Vikas Kumar
675c532eab
Ran util/update_lints.py to auto gen doc and lib.rs
2015-10-20 10:25:37 -07:00
Vikas Kumar
2951b70d15
Match on bool should be replaced with if..else block
...
1. Added another conditional in `check_expr` impl to lint if match expr
is a bool.
2. Test cases.
2015-10-20 10:18:48 -07:00
Manish Goregaokar
dea087dd17
Merge branch 'pr-394'
2015-10-18 00:54:03 +05:30
Florian Gilcher
8063916477
Cleanup as discussed in PR
2015-10-17 20:16:54 +02:00
Manish Goregaokar
853368c1d3
Make is_from_for_desugar sound (rust/28973 got fixed)
2015-10-17 04:33:05 +05:30
Florian Gilcher
39e93d572b
Regnerate README.md
2015-10-15 21:33:47 +02:00
Florian Gilcher
1bd023d3e0
New lint for needless use of nightly features
2015-10-15 21:33:47 +02:00
Manish Goregaokar
b2f4550654
Fix type complexity lint
2015-10-15 19:55:14 +05:30
Andre Bogus
33062bb620
Merge branch 'master' of https://github.com/Manishearth/rust-clippy into rustup
2015-10-15 16:19:08 +02:00
Andre Bogus
657afc1157
rustup
2015-10-15 16:02:19 +02:00
Florian Hartwig
871d9fc27c
Make ptr_arg lint warn by default
2015-10-14 20:35:44 +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
Andre Bogus
b2f1940f6f
improved precedence messages ( fixes #389 )
2015-10-13 13:59:20 +02:00
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
Manish Goregaokar
a04745e16c
Merge pull request #379 from swgillespie/zero_div_zero_nan
...
implement 0.0/0.0 -> NaN lint as described in #370
2015-10-12 11:33:35 +05:30
llogiq
d34a62b887
Merge pull request #381 from durka/patch-2
...
fix doc comment for if_let_chain!
2015-10-12 08:01:35 +02:00
Georg Brandl
be2fb9ba11
Remove "are you sure?" from lint msg.
...
No added value, and leads to punctuation clash.
2015-10-12 07:59:08 +02:00
Alex Burka
3632b93d7a
fix doc comment for if_let_chain!
2015-10-12 01:54:44 -04:00
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
b48db27152
Recommend using Mutex<()> for locking
2015-10-11 16:07:00 +02:00
Florian Hartwig
6b7fff93bc
Fix documentation that disagrees with code
2015-10-08 00:35:32 +02:00
Florian Hartwig
26b2733b15
Add a lint for sized integer types in a mutex
2015-10-07 22:58:34 +02:00
Pyriphlegethon
b7c6c30c88
Change lint description
2015-10-07 17:15:44 +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
Georg Brandl
85ac834343
RingBuf was renamed to VecDeque ( fixes #363 )
2015-10-05 22:02:14 +02:00
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
Manish Goregaokar
f76f4d52c2
Fix rustup fallout: lifetimes false positives
2015-09-30 20:10:54 +05:30
Manish Goregaokar
4fc17e7faf
rustup to rustc 1.5.0-nightly ( 65d5c0833
2015-09-29)
2015-09-30 19:54:41 +05:30
Pyriphlegethon
33a0799fa9
Remove unnecessary clones and add helper function
2015-09-30 13:08:29 +02:00
Pyriphlegethon
e2a6c9e375
Add unnecessary mut passed lint for methods
2015-09-29 18:46:16 +02:00
Ravi Shankar
185da55263
extending while_let to warn for more statements
2015-09-29 20:26:34 +05:30
Pyriphlegethon
40e180d8c7
Replace tabs by spaces
2015-09-29 13:16:53 +02:00
Pyriphlegethon
b8cdefb6cf
Add unnecessary mut passed lint
2015-09-29 13:11:19 +02:00
Georg Brandl
e8f875813d
all: remove trailing spaces
2015-09-28 07:11:03 +02:00
Manish Goregaokar
15e3774cb4
rustup to 1.5.0-nightly ( 7bf4c885f
2015-09-26)
...
fixes #348
2015-09-28 10:34:10 +05:30
Manish Goregaokar
cd11488080
rustup 2015-09-24
2015-09-25 18:52:36 +05:30
Manish Goregaokar
294d7d8586
Merge branch 'pr-347'
2015-09-24 12:01:18 +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
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
Georg Brandl
7fdf52270b
Fix stray backquote.
2015-09-19 08:49:01 +02:00
Manish Goregaokar
b56ff4319e
fix dogfood
2015-09-19 08:33:04 +05:30
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
llogiq
862c195fa1
Merge pull request #337 from Manishearth/indentfix
...
fix indentation
2015-09-17 07:44:39 +02:00
llogiq
acc83c0b02
Merge pull request #336 from Manishearth/issue335
...
ref matches: false positive with only wildcard pattern match
2015-09-17 07:43:26 +02:00
Georg Brandl
58fee220a9
fix indentation
2015-09-17 07:27:23 +02:00
Georg Brandl
e3ee87965e
ref matches: false positive with only wildcard pattern match ( fixes #335 )
2015-09-17 07:25:08 +02:00
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
llogiq
03af82afd1
removed expensive crate check from approx_const
2015-09-11 15:59:19 +02:00
llogiq
681bce925f
less false positives for approx_const and float_cmp
2015-09-11 15:30:08 +02: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
llogiq
e43f2d7e54
damn autocorrect
2015-09-07 11:49:35 +02:00
llogiq
c79d884450
replace if let by equality check
2015-09-07 11:46:04 +02:00
llogiq
92b04cd75d
split wrong_self_convention in pub/default visibility part
2015-09-07 09:17:45 +02:00
Andre Bogus
468b410d04
de-closured the item name getter
2015-09-06 21:03:09 +02:00
Andre Bogus
87e6099ad7
fix false positive len_zero in is_empty()
2015-09-06 20:57:06 +02:00
llogiq
1569fd8c55
Merge pull request #308 from Manishearth/unit_cmp
...
macro check for unit_cmp
2015-09-06 19:46:21 +02:00
Andre Bogus
391a5135e8
fixed build
2015-09-06 19:44:54 +02:00
Andre Bogus
0c74304f7b
macro check for unit_cmp
2015-09-06 19:41:09 +02:00
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
Andre Bogus
55729b7caa
dogfooding a newly caught problem
2015-09-06 10:59:06 +02:00
Andre Bogus
54393f0ef5
More strict macro check
2015-09-06 10:53:55 +02:00
llogiq
3848756be0
Made min_max Warn
by default
2015-09-05 14:20:35 +02:00
llogiq
b90e4c7bd5
hir naming, removed lookup, match full path
2015-09-05 13:15:18 +02:00
llogiq
cd91110ec0
new lint: min_max
2015-09-05 12:46:34 +02:00
llogiq
28212e4981
fixed dogfood by using snippet instead of the (escaped) literal string
2015-09-04 14:24:49 +02:00
llogiq
e11fd49b1c
Unicode lints, second attempt: Lint whole strings, help with replacement
2015-09-04 16:18:46 +05:30
Manish Goregaokar
af4d7f9b60
Merge pull request #298 from birkenfeld/as_mut
...
methods: allow &mut self for as_ methods
2015-09-04 16:16:58 +05:30
Georg Brandl
d659d039b6
methods: allow &mut self for as_ methods
2015-09-04 07:56:52 +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
llogiq
cb571bf2e2
also ignore functions
2015-09-03 10:57:11 +02:00
Manish Goregaokar
fbdba7f915
Fix ICE
2015-09-03 02:15:02 +05:30
Georg Brandl
7649d1c2a8
shadow: complete coverage of "contains_self" checker
2015-09-02 18:24:46 +02:00
Georg Brandl
6b589681c9
methods: allow multiple self kinds for "is_" methods
...
These can be static method predicates. (Found one in rust-copperline,
called Term::is_unsupported_term().)
2015-09-02 17:14:27 +02:00
Georg Brandl
846c164709
don't say "did you mean to" - use the standard "consider..."
...
"Did you mean to ..." sounds a bit condescending to me, since
if I meant to write "if let" I probably wouldn't have written "match" :)
2015-09-02 16:46:14 +02:00
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
llogiq
bc1eb84810
match region patterns
2015-09-02 07:56:13 +02:00
llogiq
1ab733cfa1
extended pattern matching
2015-09-02 07:55:07 +02:00
llogiq
08fb953e1a
extended pattern matching
2015-09-02 01:36:37 +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
Frank Denis
833493cf07
FnKind::FkClosure -> FnKind::Closure
2015-09-01 14:28:23 +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
d499d2a9a7
loops: remove debugging print
2015-08-31 08:20:39 +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
llogiq
621818e606
rustup, the ExpnInfo stuff changed
2015-08-28 14:35:20 +02:00
Manish Goregaokar
c3d4eb5bbd
Merge branch 'pr-228'
...
Conflicts:
README.md
src/methods.rs
2015-08-27 15:25:56 +02:00
Manish Goregaokar
5159e034a6
appease the dogfood gods
2015-08-27 04:40:01 +05:30
Manish Goregaokar
9ebcd0bf29
More macro checks
2015-08-27 04:33:59 +05:30
Manish Goregaokar
7a1082d916
Merge pull request #239 from jedisct1/nightly
...
Changes for rust-nightly after #27856
2015-08-27 03:44:30 +05:30
Georg Brandl
bb552dc96f
eta_reduction: fix false positive for unsafe fns ( fixes #243 )
2015-08-26 17:09:51 +02:00
llogiq
6984d2bc09
added helpful links to lints that have wiki entries
2015-08-26 14:33: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
Frank Denis
92db00863f
Changes for rust-nightly after #27856
2015-08-25 23:21:38 +02:00
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
9012d8f197
fixed false positives on structs/enum variants
2015-08-25 20:11:03 +02:00
llogiq
56cdd58ad2
Merge branch 'master' of https://github.com/Manishearth/rust-clippy into shadow
2015-08-25 20:09:50 +02:00
llogiq
974ceefc1e
shadowing detection
2015-08-25 20:06:09 +02:00
llogiq
544c14f3ef
Merge pull request #230 from birkenfeld/eq_op_fix
...
eq_op: cut back to expressions that are guaranteed side effect free
2015-08-25 19:32:12 +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
bd22521af2
shadowing detection
2015-08-25 17:36:46 +02:00
Georg Brandl
b13d318f48
all: remove unneeded deref and/or ref operations
2015-08-25 17:35:20 +02:00
Georg Brandl
88047a0953
collapsible_if: remove extraneous note output
...
This was probably a debug addition.
2015-08-25 17:35:20 +02:00
Georg Brandl
92a3394065
all: remove unneeded deref and/or ref operations
2015-08-25 14:41:35 +02:00
llogiq
5225feceaa
shadowing detection
2015-08-25 13:40:26 +02:00
Georg Brandl
d5c808acd0
collapsible_if: remove extraneous note output
...
This was probably a debug addition.
2015-08-25 13:27:21 +02:00
Georg Brandl
81ef3da03c
methods: people might be using to_string() to make a copy; add a hint for that
2015-08-25 12:46:29 +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
llogiq
961f9d68a9
Merge pull request #226 from birkenfeld/fixes
...
Two small fixes/refactorings
2015-08-24 16:21:17 +02:00
Georg Brandl
cc8f33d915
ranges: remove unneeded as_str()
2015-08-23 16:34:23 +02:00
Georg Brandl
c8a2e848ab
utils: extract utility method for matching trait method calls from loops
2015-08-23 16:32:50 +02:00
R.Chavignat
3af2e3ba85
Refactored CastPass.
2015-08-23 06:26:31 +02:00