Commit graph

1359 commits

Author SHA1 Message Date
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