Commit graph

1556 commits

Author SHA1 Message Date
Donald Robertson
fe8c9d5965 Ensuring correct lint message is output for Option and Result type 2018-06-04 19:43:03 +01:00
Donald Robertson
2b36017bad Removing unnecessary allow 2018-06-04 19:43:03 +01:00
Donald Robertson
05c1ccebaf Warn if non-trivial work is done inside .expect
- added tests for common usages of format and as_str arguments to expect
- added tests for usages of Option and Result types
- given performance impact of passing non literal expressions to expect, added to perf group
2018-06-04 19:43:03 +01:00
Bruno Kirschner
28f735bb26 Cleaned implements_ord helper function in boolean lint file. 2018-06-03 22:56:17 +02:00
Bruno Kirschner
80728a2201 Reduced scope of nonminimal_bool so that it doesn't evaluate only partially orded types. 2018-06-03 21:46:09 +02:00
Bruno Kirschner
09ea75bee9 Fixed spelling and indentation issues in neg_cmp_op_on_partial_ord related files. 2018-06-03 21:46:09 +02:00
Bruno Kirschner
86304d8dde Use declare_clippy_lint instead of declare_lint. 2018-06-03 21:46:09 +02:00
Bruno Kirschner
6d51559f62 Added lint to avoid negated comparisions on partially ordered types. 2018-06-03 21:46:09 +02:00
Oliver Schneider
c6d53ad2c0
Merge pull request #2813 from terry90/master
unreadable_literal: Fills hexadecimal values with 0 to allow better grouping
2018-06-03 12:53:45 +02:00
Terry Raimondo
2c1451817c Compute digits vec only once 2018-06-03 12:26:50 +02:00
Oliver Schneider
1c6c79f92c Version bump 2018-06-03 08:59:10 +02:00
Victor Korkin
24ab207671 Divide FN_TO_NUMERIC lint into two.
FN_TO_NUMERIC_CAST_WITH_TRUNCATION is correctness check
FN_TO_NUMERIC_CAST is only style check
2018-06-01 23:08:11 +07:00
Oliver Schneider
1ba658772a
Merge pull request #2816 from mockersf/multiple-impl
adding to restriction a lint that check for multiple inherent implementations
2018-05-31 13:33:35 +02:00
Oliver Schneider
41f23f5b4d
Merge pull request #2819 from zayenz/no-op-ref-in-macro
avoid op-ref in macros
2018-05-31 12:02:09 +02:00
Oliver Schneider
bb2f6a5011
Merge pull request #2821 from mati865/rust-2018-migration
Rust 2018 migration
2018-05-30 15:55:11 +02:00
Victor Korkin
e6811b9c26 Fix 'help' message 2018-05-30 16:55:03 +07:00
Mateusz Mikuła
551c02ecbf Upgrade to edition 2018 2018-05-30 10:18:52 +02:00
Mateusz Mikuła
424a33720d Run rustfix 2018-05-30 10:15:50 +02:00
Mateusz Mikuła
26f3feb980 Add rust_2018_preview feature and fix rustfmt annotation 2018-05-30 10:10:01 +02:00
Victor Korkin
b69520f5fd Fixes for suggestion message, tests and lint explanation. 2018-05-30 11:48:46 +07:00
Victor Korkin
e4b2a97401 weird thing 2018-05-30 07:55:48 +07:00
François Mockers
d372f1674d move lint to restriction group 2018-05-29 21:28:52 +02:00
François Mockers
44f4ea6dbf adding to pedantic a lint that check for multiple inherent implementations 2018-05-29 21:28:52 +02:00
Devon Hollowood
9118cd633e Simplify lifetime-differences-only detection
Now instead of reinventing the wheel with differ_only_in_lifetimes(), we
use TyCtxt's erase_regions()
2018-05-29 09:18:49 -07:00
Devon Hollowood
8134863c13 Fix behavior with generic lifetime parameters 2018-05-29 09:18:49 -07:00
Devon Hollowood
2a606b5220 Don't lint lifetime-only transmutes 2018-05-29 09:18:49 -07:00
Victor Korkin
f6e0388e08 Change lint type to unique and add the suggestion. 2018-05-29 22:56:38 +07:00
Oliver Schneider
400aab9232
Merge pull request #2820 from flip1995/unused_def_conf
Remove unused define_conf-macro definitions
2018-05-29 15:30:32 +02:00
flip1995
3a41e0172c
Remove unused define_conf-macro definitions 2018-05-29 14:51:16 +02:00
Oliver Schneider
a338fa9b95 Fix dogfood 2018-05-29 14:45:10 +02:00
Mikael Zayenz Lagerkvist
f97c38de94 avoid op-ref in macros
Avoid running op-ref inspection in macros since the macro
may be invoked in many different types of contexts.

Solves #2818 and incidentally avoids #2689.
2018-05-29 13:17:37 +02:00
Oliver Schneider
ce229b2025 Version bump 2018-05-29 11:58:58 +02:00
Mateusz Mikuła
8ed8ee895a Update to nightly 2018-05-28 2018-05-29 10:56:58 +02:00
Victor Korkin
cf8f379657 Add lint on cast Fn to numerical. 2018-05-28 23:31:55 +07:00
Andrea Lattuada
e86268e67f Add support for ExprCall in clippy::author 2018-05-28 14:48:34 +02:00
Terry Raimondo
b81fd202a0
Add tests
Fix tests
2018-05-28 14:23:06 +02:00
Terry Raimondo
2033a1eb0e
unreadable_literal: Fills hexadecimal values with 0 to allow grouping (c.f #2300) 2018-05-28 13:55:27 +02:00
Oliver Schneider
0d1e06d638
Merge pull request #2808 from Aaronepower/master
Added lint for unnecessary references.
2018-05-28 13:50:31 +02:00
Aaron Power
8b679176fa Added lint for unnecessary references 2018-05-28 13:07:19 +02:00
Oliver Schneider
b979f62aab
Merge pull request #2810 from Aaronepower/stable_feature_flags
Removed stable feature flags
2018-05-28 12:59:25 +02:00
Oliver Schneider
9d12b04c32
Merge pull request #2806 from mockersf/loop-mut-cond
better parsing of condition in while loop for mutability
2018-05-28 12:55:44 +02:00
Oliver Schneider
f30db144dc
Merge pull request #2805 from reiner-dolp/update_lints
running update lints script
2018-05-28 12:51:44 +02:00
Aaron Power
1931f53396 Removed stable feature flags 2018-05-28 10:03:27 +02:00
Aaron Power
ceea20153c Refactored nested if lets to if_chain! macro 2018-05-28 09:50:25 +02:00
François Mockers
5379fc1b28 better parsing of condition in while loop for mutability
allow condition to be a block: by calling visit_expr of the visitor directly on the condition instead of walk_expr on the whole expression, we bypass the match to ExprWhile that calls visit_expr on the condition and visit_block on the body. This allow to re-enable visit_block in the visitor, as it won't be called on the while body
allow condition to use static variables: maintain a list of static variables used, and if they are mutable
2018-05-27 23:59:07 +02:00
Reiner Dolp
78b8d5cf1a running update lints script 2018-05-27 16:16:41 +02:00
Oliver Schneider
fc008aa14c Rustup 2018-05-26 10:23:34 +02:00
Michael A. Plikk
1f10dd2606 Fix note on macro outside current crate. Changed group to restricted 2018-05-24 19:38:40 +02:00
Michael A. Plikk
88c3c2f1c2 Rename panic files to panic_unimplemented 2018-05-24 10:04:18 +02:00
Michael A. Plikk
77794e91e2 Create lint for unimplemented!() 2018-05-24 10:04:18 +02:00
Oliver Schneider
e7a3e03c6e Version bump 2018-05-23 16:38:19 +02:00
Mateusz Mikuła
a1c44e966e Update to nightly 2018-05-22
Fixes #2788
2018-05-23 14:47:48 +02:00
Mateusz Mikuła
3c6503eb4b Format code 2018-05-22 10:21:42 +02:00
Philipp Hansch
74be5632a3
Fix chrono crash due to empty param_env 2018-05-21 17:58:34 +02:00
Oliver Schneider
0bf96259f1 Version bump 2018-05-20 10:02:29 +02:00
Oliver Schneider
79d870ef66
Merge pull request #2777 from rust-lang-nursery/scoped_attrs
Use the new scoped tool attributes
2018-05-20 09:56:55 +02:00
Cyril Plisko
7b715583d4 rustup to nightly 2018-05-19
clippy_lints does not compile: non-primitive cast: `rustc_target::abi::Size` as `usize`

Fixes #2780
2018-05-20 09:20:01 +03:00
Oliver Schneider
e0df4ccfc5 Use the new scoped tool attributes 2018-05-19 14:04:57 +02:00
Oliver Schneider
ebe0b0eed5 Version bump 2018-05-19 13:01:26 +02:00
Philipp Hansch
ed885dc2b3
Fix ICE for issues 2767, 2499, 1782 2018-05-17 21:12:07 +02:00
Philipp Hansch
6eb07cc5b6
Fix ICE for issue 2594 2018-05-17 21:12:06 +02:00
Oliver Schneider
c0bf3a4696 Version bump 2018-05-17 11:40:12 +02:00
Mateusz Mikuła
f0c823a85e Rustup to 2018-05-16 2018-05-17 11:21:15 +02:00
Oliver Schneider
c658fc8cbc
Version bump 2018-05-14 11:29:22 +02:00
Christopher Durham
2c2e7f4d5f
Update for rust-lang/rust#50536
Fixes #2757
2018-05-14 04:34:11 -04:00
Philipp Hansch
ecf4f5128f
Fix two typos 2018-05-13 13:47:54 +02:00
Oliver Schneider
a8d7e5a1f2
Version bump 2018-05-13 11:16:07 +02:00
Philipp Hansch
26b48bbdfc
Rustup to 2018-05-13 2018-05-13 10:44:57 +02:00
Oliver Schneider
22bef4ce28
Patterns, locals and matches for author lint 2018-05-11 19:05:34 +02:00
Bruce Mitchener
d5b5ba6b9f Update to regex 1 (and regex-syntax 0.6). 2018-05-11 16:32:05 +07:00
Oliver Schneider
6baca22e27
Version bump 2018-05-11 09:56:57 +02:00
Oliver Schneider
39c0f575f2
Reintroduce the lost (im)mutability checks 2018-05-11 09:53:22 +02:00
Philipp Hansch
665cf96221
Rustup to 2018-05-11 2018-05-11 09:53:21 +02:00
Philipp Hansch
be3cba8852
Merge pull request #2735 from rust-lang-nursery/ice_melting
Check that we don't treat any type but a range type as a range
2018-05-09 21:56:34 +02:00
flip1995
db4e7ac725
panic_params: don't lint escaped squigglies 2018-05-09 12:29:28 +02:00
Oliver Schneider
c6e35eae53
Check that we don't treat any type but a range type as a range 2018-05-08 17:16:01 +02:00
Oliver Schneider
92a6f62308
Merge pull request #2730 from NiekGr/len_zero_use_of_one
Update len_zero to handle comparisions with one
2018-05-07 11:49:25 +02:00
Oliver Schneider
e456241f18
Version bump 2018-05-07 10:00:58 +02:00
NiekGr
e7a6b3e613 Update len_zero to handle comparisions with one
I have added test cases for comparisons with zero and one.
While implementing handling of one, incorrect handlings of zero
were also fixed.

fixes rust-lang-nursery/rust-clippy/#2554
2018-05-06 23:54:05 +02:00
Michael Wright
1477f34858 Fixes compilation for rust nightly 2018-05-05
Closes #2725
2018-05-06 14:05:41 +02:00
Evan Simmons
d4b536f540 Fix 1x..x.0 false positive, pretty suggestion 2018-05-05 09:45:14 -07:00
Oliver Schneider
642baa91cf
Version bump 2018-05-04 15:54:56 +02:00
Oliver Schneider
c1b39c4551
Merge pull request #2713 from alexreg/nightly-fix
Fixed build for latest rust master
2018-05-04 15:06:59 +02:00
Oliver Schneider
9ce6fb34ca
Satisfy dogfood 2018-05-04 12:59:45 +02:00
Oliver Schneider
8c9bb89608
Update inline_fn_without_body.rs 2018-05-04 10:17:30 +02:00
Alexander Regueiro
00b549ad40 Fixed build for latest nightly (again) 2018-05-03 23:28:48 +01:00
Oliver Schneider
c7ce6c07b1 Rustup field -> method transition of ..= 2018-05-03 15:52:44 +02:00
Oliver Schneider
8f1a98ff08
remove unused crate import 2018-05-03 10:56:02 +02:00
Oliver Schneider
77de1000d7
Merge pull request #2714 from imp/2709_simplify_some_internal_code
Simplify some internal code
2018-05-01 22:14:42 +02:00
Oliver Schneider
ee574464c8
Merge pull request #2711 from phansch/fix_2707
Prevent crash when macro was in different file
2018-05-01 21:28:48 +02:00
Cyril Plisko
e94ec44ab3 Simplify some internal code
Addresses #2709
2018-05-01 20:33:32 +03:00
Philipp Hansch
5d36edc90d
Prevent crash when macro is in different file
This was caused by a macro in a different file.
The `target.span` was be in the file of the macro definition and the
`item.span` in the file of the calling code.
2018-05-01 18:46:15 +02:00
Alexander Regueiro
c7ff9334a6 Fixed build for latest nightly 2018-05-01 17:10:25 +01:00
Oliver Schneider
f69dd6ad2c
Merge pull request #2672 from ysimonson/multiple-crate-versions
Lint for multiple versions of dependencies
2018-05-01 16:48:53 +02:00
Oliver Schneider
ce9715a834
Merge pull request #2701 from nathan/patch-1
Add third variant to {pub_,}enum_variant_names examples
2018-05-01 16:47:53 +02:00
Yusuf Simonson
7de706b34b Lint for multiple versions of dependencies 2018-04-30 06:20:39 +07:00
Philipp Hansch
1712e18b77
Rustup to latest nightly
Due to https://github.com/rust-lang/rust/pull/48995 and
https://github.com/rust-lang/rust/pull/49894
2018-04-28 12:56:31 +02:00
Nathan
3373fa97e2 Add third variant to {pub_,}enum_variant_names examples
The default value for `enum-variant-name-threshold` is 3, so the old examples (which only have two enum variants) don't actually trigger the lint by default.
2018-04-27 18:47:11 -04:00
Oliver Schneider
d45612e606
Merge pull request #2696 from nathan/patch-1
Fix rustfmt-induced missing line comments in examples
2018-04-27 23:43:57 +02:00
Mateusz Mikuła
cc7d66aa9c rustup 2018-04-27 14:00:43 +02:00
Nathan
c9c649b315
Remove extraneous `'s in {wrong,crosspointer}_transmute examples 2018-04-27 02:43:16 -04:00
Nathan
78b141d937
Fix missing line comments in {drop,forget}_copy examples 2018-04-27 02:40:19 -04:00
Nathan
7f0f8acb42
Fix missing line comment in drop_ref example 2018-04-27 02:39:14 -04:00
Nathan
8ad5cb6170
Fix missing line comment in crosspointer_transmute example 2018-04-27 02:37:40 -04:00
Nathan
f327f26113
Fix missing line comment in doc_markdown example
rustfmt [wrapped the line](b25b6b3355 (diff-561823671726302d969756ded53a13a7L22)), so we need a second `///`
2018-04-27 02:31:36 -04:00
Oliver Schneider
3b6440212d
Merge pull request #2673 from estk/excessive_precision
Excessive precision
2018-04-25 18:37:42 +02:00
Evan Simmons
9b14ad493b New excessive precision lint for floats 2018-04-24 15:18:23 -07:00
Devon Hollowood
f0e09d43c9 Make cast_ptr_alignment ignore c_void 2018-04-24 11:37:51 -07:00
Oliver Schneider
faefb4f225
Merge pull request #2684 from 17cupsofcoffee/infallible-destructuring-match
Lint for destructuring tuple structs/variants with an infallible single-armed match
2018-04-24 19:08:27 +02:00
Joe Clay
3c38a36d5a Implement lint for destructuring tuple structs with a let and a match (closes #2671) 2018-04-24 17:56:13 +01:00
Brad Gibson
1969d423a7 Corrected messaging to warn against less- to more-strictly align types, rather than the other way around. No logic changes required. 2018-04-23 10:59:53 -07:00
Michael Recachinas
54c0edcfe8 Add smaller check_unformatted to write.rs and fix precision,width,align false positive 2018-04-21 19:51:58 +01:00
Oliver Schneider
c5b39a5917
Version bump 2018-04-19 08:36:22 +02:00
Oliver Schneider
f786a36949
Rustup 2018-04-17 10:52:25 +02:00
Oliver Schneider
ae3213747d
Merge pull request #1467 from philipturnbull/option_map_nil_fn
Lint `Option.map(f)` where f returns unit
2018-04-15 16:14:25 +02:00
Philipp Hansch
26b9911e07
Refactor out enum and address nits 2018-04-15 15:37:11 +02:00
Oliver Schneider
9dc9487567
Version bump 2018-04-15 15:01:48 +02:00
MSI\Stew's Laptop
d175c797e5
fixing error message for empty println macro 2018-04-15 14:00:28 +02:00
Philipp Hansch
4f4e20c561
Also lint Result.map for unit returns 2018-04-15 13:59:57 +02:00
Philipp Hansch
8307a899e9
Rename option_map_unit_fn to map_unit_fn 2018-04-15 13:01:10 +02:00
Philipp Hansch
d54f70f1f6
Generate let binding variable name for some cases
Given a map call like `x.field.map ...` the suggestion will contain:
`if let Some(x_field) ...`

Given a map call like `x.map ...` the suggestion will contain:
`if let Some(_x) ...`

Otherwise it will suggest: `if let Some(_) ...`
2018-04-15 13:01:10 +02:00
Philipp Hansch
d87385b406
Use approximate_suggestion for non-reducible closures 2018-04-15 13:01:10 +02:00
Philipp Hansch
7de707fdba
Remove further semicolon reduction 2018-04-15 13:01:10 +02:00
Philipp Hansch
a3ff21f4d6
Rename lint to option_map_unit_fn
Rust does not have nil.
2018-04-15 13:01:09 +02:00
Philipp Hansch
fbd71f901f
Use declare_clippy_lint and 'complexity' category 2018-04-15 13:01:09 +02:00
Philipp Hansch
ca60e8a2a0
Cleanup misc::check_nan
This was a bit messed up after a bigger rebase.
2018-04-15 13:01:09 +02:00
Philipp Hansch
991a30237a
Make it compile again 2018-04-15 13:01:09 +02:00
Phil Turnbull
d0bdfe5ce3
Handle non-trivial nil closures
`reduce_nil_closure` mixed together a) 'is this a nil closure?' and b) 'can it
be reduced to a simple expression?'. Split the logic into two functions so we
can still generate a basic warning when the closure can't be simplified.
2018-04-15 13:01:09 +02:00
Phil Turnbull
2f52d1d568
Return Spans instead of Cow<&str>'s 2018-04-15 13:01:09 +02:00
Phil Turnbull
30f2480fd8
Lint closures that return nil 2018-04-15 13:01:09 +02:00
Phil Turnbull
302f5d05f5
Lint Option.map(f) where f never returns 2018-04-15 13:01:09 +02:00
Phil Turnbull
e5ecbb55ee
Lint Option.map(f) where f returns nil 2018-04-15 13:01:09 +02:00
Oliver Schneider
b2e4b88d18
Merge pull request #2662 from mikerite/issue_2546
Fix useless_format false negative
2018-04-15 11:57:57 +02:00
Michael Wright
d171e8987e Fix clippy error 2018-04-15 05:20:30 +02:00
Michael Wright
a9c8d1bd90 Fix compilation for nightly 2018-04-15
This only fixes compilation and the build. It's possible that the `author`
and `inspector` lints are broken but there are no failing tests.

Closes #2667
2018-04-15 05:01:43 +02:00
Stefano Probst
01faa906d2
Fix Markdown link syntax in lint doc
Currently this link is wrong rendered. See https://rust-lang-nursery.github.io/rust-clippy/v0.0.193/index.html#iter_next_loop
2018-04-14 11:35:52 +02:00
Michael Wright
c7ad71ccf2 Fix clippy warnings 2018-04-12 08:50:42 +02:00
Michael Wright
6ae617b313 Fix useless_format false negative
Closes #2546
2018-04-12 08:21:03 +02:00
Oliver Schneider
8ec61a613a
Merge pull request #2661 from devonhollowood/ptr-ptr-casts
Replace `misaligned_transmute` lint
2018-04-11 13:23:15 +02:00
Devon Hollowood
b77d74030b Deprecate misaligned_transmute 2018-04-11 02:50:04 -07:00
Devon Hollowood
c6bc682325 Fix misaligned_transmute lint
This is done by adding two new lints: cast_ptr_alignment and
transmute_ptr_to_ptr. These will replace misaligned_transmute.
2018-04-11 02:17:59 -07:00
Oliver Schneider
4015395888
Version bump 2018-04-08 11:13:46 +02:00
Oliver Schneider
0692b2bb92
Temporarily disable the needless_borrow lint 2018-04-08 11:13:46 +02:00
Oliver Schneider
d247d9c690
Merge pull request #2645 from TimNN/regex-bytes-utf8
Allow invalid UTF-8 in bytes Regexes
2018-04-08 08:58:38 +02:00
Evan Simmons
d712991917 New lints for write! / writeln! macros. 2018-04-07 22:45:26 -07:00
Tim Neumann
fad826f966 allow invalid UTF-8 in bytes Regexes 2018-04-07 22:18:51 +02:00
Philipp Hansch
90e7d93d6c
Fix nonminimal_bool false positive
It was checking any is_ok, is_err, is_some, is_none method for negation
but it should only perform the check for the built-in types, not custom
types.
2018-04-07 12:52:59 +02:00
Oliver Schneider
fbb5050d82
Merge pull request #2641 from rcoh/patch-2
Update hash_xor_eq docs to match behavior
2018-04-07 09:42:54 +02:00
Russell Cohen
4b3326efd0
Fix docs to match behavior 2018-04-06 22:44:25 -07:00
Michael Wright
fe8068c41b Fix compilation for nightly 2018-04-06
Breakages for introduced by rust pull request
'AST: Give spans to all identifies' - rust-lang/rust/pull#49154

Closes #2639
2018-04-07 07:32:30 +02:00