Manish Goregaokar
dbf1cdf34a
Fix panic lint
2015-12-24 15:27:31 +05:30
mcarton
592ca26e90
Fix #518
2015-12-23 22:37:52 +01:00
mcarton
4958878ad2
Fix missing parameter in panic!
2015-12-23 22:36:37 +01:00
mcarton
0fa8481ba3
Put tests in tests folder
2015-12-23 17:48:41 +01:00
mcarton
2fd3093395
Only run MATCH_OVERLAPPING_ARM on integral matches
2015-12-23 11:25:44 +01:00
mcarton
90efb7b76d
Fix typo
2015-12-23 11:25:32 +01:00
mcarton
1aa3956b8a
Update README
2015-12-23 02:45:17 +01:00
mcarton
0c8de9ed52
Split MatchPass::check_expr for dogfood
2015-12-23 02:42:01 +01:00
mcarton
3373ea43c0
Consider literal patterns in MATCH_OVERLAPPING_ARM
2015-12-23 02:42:01 +01:00
mcarton
7216e83189
Implement #471
2015-12-23 02:42:01 +01:00
Florian Hartwig
e4fbeb4947
Don't trigger block_in_if_condition_expr lint if the block is unsafe
2015-12-23 02:12:08 +01:00
Manish Goregaokar
dd16ac2ad7
Merge pull request #509 from mcarton/array-indexing
...
Implement #364
2015-12-22 10:22:06 +05:30
Manish Goregaokar
ea03c0d9e3
Merge pull request #514 from mcarton/remove-dup
...
Remove dup
2015-12-22 10:18:12 +05:30
mcarton
0e4259a827
Remove duplicated if_let_chain! macro definition
2015-12-22 00:48:50 +01:00
Markus Unterwaditzer
acc47a3bd5
Nightly fixes
...
As of
e3da2a9003 (diff-12e06f1e9ca371a11bdc4615f50a4071L59)
HirVec is syntax::ptr::P instead of Vec.
2015-12-22 00:22:35 +01:00
mcarton
826827fe94
Fix some typos
2015-12-21 20:47:19 +01:00
mcarton
3abdcd4709
Implement #364
2015-12-21 19:36:58 +01:00
Devon Hollowood
b190aa7deb
Implement #507
...
Make `used_underscore_binding` lint compatible with MacroAttributes
expansions. TODO: Add a good test for this.
2015-12-21 01:03:12 -08:00
Manish Goregaokar
4a32445aa7
Add macro check to used_underscore
2015-12-20 04:53:29 +05:30
Manish Goregaokar
a65a7770b3
Rust upgrade to rustc 1.7.0-nightly ( 8ad12c3e2
2015-12-19)
2015-12-19 19:08:22 +05:30
Manish Goregaokar
9dca15de3e
Merge pull request #499 from devonhollowood/underscore_binding
...
Add used_underscore_binding lint
2015-12-19 19:02:06 +05:30
Devon Hollowood
98d21f9fc5
Make compatible with unused_variables
lint
2015-12-18 16:04:33 -08:00
Devon Hollowood
02cb24de82
Remove local variable check
2015-12-18 13:45:03 -08:00
Manish Goregaokar
b900e88910
Merge pull request #494 from sanxiyn/suggestion-2
...
Use suggestion for needless_return
2015-12-17 22:17:32 +05:30
Devon Hollowood
e620a1d57c
Make suggested changes
2015-12-16 17:28:26 -08:00
llogiq
c645a9febe
adding missing doc comments
2015-12-14 22:16:56 +01:00
llogiq
827082ac41
fix boxed_local example
2015-12-14 21:17:11 +01:00
Manish Goregaokar
8105260d6e
Merge pull request #501 from oli-obk/fix/seme
...
fix cyclomatic complexity lint (fixes #491 , fixes #478 )
2015-12-14 22:23:42 +05:30
Oliver Schneider
cc1d696cb9
fix fallout from CC improvements
2015-12-14 14:30:09 +01:00
Oliver Schneider
902c7d832b
fix cc computation in the presence of diverging calls
...
CFG treats diverging calls as its completely own path out of the function.
While this makes sense, it should also mean that a panic should increase the cyclomatic
complexity. Instead it decreases it.
Minimal example:
```rust
if a {
b
} else {
panic!("cake");
}
d
```
creates the following graph
```dot
digraph G {
"if a" -> "b"
"if a" -> "panic!(\"cake\")"
"b" -> c
}
```
which has a CC of 1 (3 - 4 + 2). A CC of 1 means there is one path through the program.
Obviously that is wrong. There are two paths. One returning normally, and one panicking.
2015-12-14 14:29:20 +01:00
llogiq
c0bccc9567
more doc comments
2015-12-14 13:32:07 +01:00
llogiq
d7292fe235
more docs
2015-12-14 08:03:01 +01:00
Manish Goregaokar
f2b977907c
Merge branch 'more_wiki'
2015-12-13 21:58:18 +05:30
Devon Hollowood
6960bf2ebc
Make ExprField follow single-underscore rules
2015-12-12 21:59:25 -08:00
Devon Hollowood
b24e3aeea0
Add wiki docs, in line with #492
2015-12-12 21:56:05 -08:00
Devon Hollowood
aeb5a0e60c
Reduce false positives
...
Add macro checking, and only lint for single leading underscores
2015-12-12 21:39:10 -08:00
Devon Hollowood
6091112698
Update tests
2015-12-12 21:39:10 -08:00
Devon Hollowood
43b96d59ad
Run update_lints.py
2015-12-12 21:39:10 -08:00
Devon Hollowood
9de308ee15
Add used_underscore_binding lint
2015-12-12 21:39:10 -08:00
Manish Goregaokar
4ae43b10f0
Add wiki note for escape analysis
2015-12-13 09:08:58 +05:30
Cesar Eduardo Barros
8e59be318c
Mention VecDeque in linkedlist lint
...
I couldn't find anything named RingBuf in the standard library. Some
search revealed that it had been renamed to VecDeque before the first
stable Rust release.
2015-12-12 20:05:06 -02:00
Manish Goregaokar
6aa656a910
Merge pull request #492 from Manishearth/wiki
...
added wiki comments + wiki-generating python script
2015-12-11 09:20:19 -05:00
Seo Sanghyeon
974ab43453
Use suggestion for needless_return
2015-12-11 16:28:05 +09:00
llogiq
5bbc1427fd
added wiki comments + wiki-generating python script
2015-12-11 01:22:27 +01:00
Manish Goregaokar
b9546599e3
Check for unused lifetimes in bounds ( fixes #489 )
2015-12-10 12:02:59 -05:00
Manish Goregaokar
b865e30b49
Upgrade rust to rustc 1.6.0-nightly ( 462ec0576
2015-12-09)
2015-12-09 15:56:49 -05:00
Seo Sanghyeon
213c15cd66
Add span_lint_and_then and use it
2015-12-09 02:46:14 +09:00
Seo Sanghyeon
35b5c3efdd
Use suggestion for redundant_closure
2015-12-08 15:03:01 +09:00
llogiq
3260b501a2
Merge pull request #483 from Manishearth/bored
...
Add lint for unused lifetimes (fixes #459 )
2015-12-07 21:47:10 +01:00
Manish Goregaokar
e8686a3ecd
Merge branch 'pr-482'
2015-12-07 07:23:52 -05:00
Guillaume Gomez
72117836f1
Add check on redundant _ bindings in structs
2015-12-07 13:16:59 +01:00
Manish Goregaokar
c7b87a06d2
Add lint for unused lifetimes ( fixes #459 )
2015-12-07 06:55:14 -05:00
Manish Goregaokar
c4e9982dd7
Merge pull request #481 from fhartwig/lifetime-with-alias
...
Make unneeded_lifetimes lint work properly with type aliases
2015-12-06 09:08:40 +05:30
Florian Hartwig
ac39dc290b
Remove obsolete workaround
2015-12-06 02:05:32 +01:00
Florian Hartwig
62db392730
Make lifetimes lint work with type aliases and non-locally-defined structs
2015-12-06 02:04:13 +01:00
Robert Clipsham
978c41584f
Fix clippy with latest Rust nightly.
2015-12-05 12:33:58 +00:00
Manish Goregaokar
dc414e6c02
Make panic in CC silencable (partial #478 )
2015-12-05 14:23:00 +05:30
Manish Goregaokar
18e81c1b59
Rudimentary escape analysis for Box<T>
2015-12-04 20:23:14 +05:30
llogiq
e90acaf596
Merge pull request #460 from oli-obk/cyclomatic_complexity
...
Cyclomatic complexity
2015-12-03 16:52:53 +01:00
Oliver Schneider
04524c549e
improve cc of function
2015-12-03 16:41:55 +01:00
Oliver Schneider
3d1b7e1957
high-speed-dogfood
2015-12-03 16:41:55 +01:00
Oliver Schneider
617c820e6b
compute cyclomatic complexity (adjusted to not punish Rust's match
)
2015-12-03 16:41:55 +01:00
Seo Sanghyeon
26f539eaa3
Remove unused qualifications
2015-12-02 23:25:12 +09:00
Manish Goregaokar
ba59ed05e3
Rust upgrade to rustc 1.6.0-nightly ( 52d95e644
2015-11-30)
2015-11-30 23:16:28 +05:30
Hobofan
7d583dab80
fix for latest nightly
...
Fixes breakage introduced by rust-lang/rust#30043
2015-11-27 14:50:23 +01:00
Manish Goregaokar
409c0f0998
Merge pull request #468 from devonhollowood/option-methods
...
Lint `map(f).unwrap_or(a)` and `map(f).unwrap_or_else(g)`
2015-11-26 14:22:27 +05:30
Devon Hollowood
443e4556c2
Add lints suggesting map_or() and map_or_else()
...
In accordance with the latter lint, replace map().unwrap_or_else() in
src/mut_mut.rs with map_or_else()
2015-11-25 23:56:45 -08: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
cf54006449
Fixes to build with current rust nightly
2015-11-25 16:28:29 +01:00
Seo Sanghyeon
b1a0abe404
Don't panic
2015-11-25 13:57:50 +09:00
Seo Sanghyeon
746991572f
Extend match_ref_pats to desugared matches
2015-11-25 02:47:17 +09:00
Seo Sanghyeon
a3e8091e87
Dogfood match_ref_pats for if let
2015-11-25 02:44:40 +09:00
Manish Goregaokar
b40e80f039
spurious newline
2015-11-23 16:34:23 +05:30
Manish Goregaokar
84ad2be1df
Merge branch 'pr-462'
...
Conflicts:
README.md
2015-11-22 21:58:13 +05:30
John Quigley
d4cf288b38
Add block_in_if lint, #434
2015-11-22 21:52:06 +05:30
Florian Hartwig
a36707bffd
Appease clippy by not shadowing variables
2015-11-19 20:19:19 +01:00
Florian Hartwig
096c064d43
Simplify has_debug_impl
2015-11-19 20:13:36 +01:00
Florian Hartwig
cad88a9137
warn on use of ok().expect()
2015-11-19 17:15:21 +01:00
Florian Hartwig
9511e6739d
Update to latest rust nightly
2015-11-19 15:51:30 +01:00
Seo Sanghyeon
1d602d0f12
rustfmt a little
2015-11-17 14:22:57 +09:00
Seo Sanghyeon
b17e38782e
Remove trailing commas in match arms with blocks
2015-11-17 13:39:42 +09:00
llogiq
1555eed5fb
Merge pull request #452 from fhartwig/lifetime-false-positives
...
Fix some false positive in needless_lifetimes lint
2015-11-14 09:25:19 +01:00
Andrew Paseltiner
91763d7725
Match min
and max
functions using DefId
...
Closes #446 .
2015-11-11 11:08:33 -05:00
Andrew Paseltiner
e8a239a1a2
Add lint for useless transmutes
...
Closes #441 .
2015-11-11 10:53:11 -05:00
Florian Hartwig
e48973eb9f
Track elided lifetimes in types and trait objects
2015-11-11 00:12:45 +01:00
Andre Bogus
42ae1e6918
use rustc's eval_const, bail on (negative) infinity
2015-11-10 11:23:47 +01:00
Andre Bogus
aea2eb7da7
use visitor for contains_self
2015-11-10 10:25:21 +01:00
Andrew Paseltiner
2801c1031d
Remove executable permission from remaining source files
2015-11-09 08:04:41 -05:00
Manish Goregaokar
764791b83e
Merge pull request #440 from Manishearth/map_clone
...
match .map(Clone::clone)
2015-11-08 10:13:55 +05:30
llogiq
a0cd8fc943
match .map(Clone::clone)
2015-11-05 17:11:41 +01:00
Manish Goregaokar
c7df4bd000
Rustup to rustc 1.6.0-nightly ( effcd2965
2015-11-04)
...
fixes #437
2015-11-05 08:20:28 +05:30
Seo Sanghyeon
3322ffa8a0
New lint for assignment to temporary
2015-11-04 21:37:18 +09:00
wartman4404
764eedd050
check for Deref conversions
2015-11-03 21:11:40 -06:00
wartman4404
414c0d20f7
New lint for using .cloned()
2015-11-03 21:01:52 -06:00
Nathan Weston
d28b8e169f
New lint for zip with array length instead of enumerate()
...
Fixes #11 .
2015-11-03 15:55:20 -05:00
Manish Goregaokar
dbb8a872a3
Fix ptr-arg false positive for trait impls
...
Fixes #425
2015-10-31 05:18:05 +05:30
llogiq
555328cc7b
Merge pull request #422 from sanxiyn/no-effect
...
New lint for statement with no effect
2015-10-29 12:05:28 +01:00
Seo Sanghyeon
0fe5981870
New lint for statement with no effect
2015-10-29 15:50:35 +09:00
wartman4404
8e4c2171d2
Don't show single_match if match_bool also applies
2015-10-28 22:26:48 -05:00
Florian Hartwig
c5b6fda399
Allow needless_lifetime to pass dogfood.sh
2015-10-27 18:28:36 +01: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
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