Commit graph

1345 commits

Author SHA1 Message Date
Joe Frikker
60a80849ce Adding try_err lint 2019-06-22 16:37:05 -04:00
Daniele D'Orazio
66dbc02b05 more idiomatic code 2019-06-21 14:46:34 +02:00
Daniele D'Orazio
e1a78ae528 update tests and fix lints in clippy 2019-06-21 14:17:59 +02:00
Daniele D'Orazio
6396a7a425 make needless_return work with void functions 2019-06-21 13:58:22 +02:00
Lzu Tao
4fa498a3eb Fix warnings about unnecessary lifetime bounds
Rustup https://github.com/rust-lang/rust/pull/61172
2019-06-20 01:36:23 +07:00
Daniele D'Orazio
be14ea8c37 fix suggestion for floating points inequality
It should be of the form `(a - b).abs() > error` whereas it was
`(a - b).abs() < error` that is instead what should be used for equality.
2019-06-17 16:42:43 +02:00
flip1995
7e07d1bed8
Restructure rename tests 2019-06-14 10:45:03 +02:00
krk
fefa7e7f67
Register rename to the LintStore. 2019-06-14 10:45:03 +02:00
krk
55740219b0
Rename REDUNDANT_STATIC_LIFETIME to REDUNDANT_STATIC_LIFETIMES. 2019-06-14 10:45:03 +02:00
krk
637e92d44e
Rename const_static_lifetime to redundant_static_lifetime. 2019-06-14 10:45:02 +02:00
krk
b38ce08e76
Merge StaticConst and StaticStatic lints into StaticConst. 2019-06-14 09:41:47 +02:00
krk
16bd4796e9
Add lint for statics with explicit static lifetime. 2019-06-14 09:41:46 +02:00
Thiago Arrais
b364eb7b54 Adds lint for integer division 2019-06-12 09:37:14 -03:00
Grzegorz
d4ad23bb3f redundant_closure_for_method_calls fixes:
lint does not trigger when there is a difference in mutability
lint does not trigger when the method belongs to a trait which is not implemebted directly (Deref)
2019-06-12 13:43:36 +02:00
Alexander Shabalin
41a4ce52dd Workaround for rust-lang/rustfmt#3615 2019-06-10 20:19:29 +03:00
Alexander Shabalin
86bab94631 Fixing eta with respect to lazy evaluation. 2019-06-10 13:58:40 +03:00
Michael Wright
b726b41daf Add OUTER_EXPN_INFO lint 2019-06-08 13:35:04 +02:00
bors
5be4e71262 Auto merge of #4136 - euclio:println-writeln-suggestions, r=flip1995
add suggestions for print/write with newline lint

changelog: Add machine-applicable suggestions for `print!`/`write!` with newline lints.
2019-06-06 08:26:48 +00:00
Michael Wright
98585a0324 Fix .map(..).unwrap_or_else(..) bad suggestion
Closes #4144
2019-06-02 08:50:20 +02:00
Philipp Hansch
6feef17071
Fix ellipsis_inclusive_range_patterns lint warnings
Changed from `allow` to `warn` in https://github.com/rust-lang/rust/pull/61342
2019-06-01 07:54:47 +02:00
Andy Russell
2d0c797da6
add suggestions for print/write with newline lint 2019-05-30 13:46:04 -04:00
bors
0ab3f1762e Auto merge of #4113 - rust-lang:author, r=flip1995
Fix `Block`  dump in author lint

changelog: The `#[clippy::author]` attribute now emits correct pattern code for block expressions
2019-05-30 10:34:56 +00:00
Philipp Hansch
2c72026fcb
Rustup to https://github.com/rust-lang/rust/pull/61203
Migrates all trait objects to use `dyn`
2019-05-30 08:31:09 +02:00
Oliver Scherer
3908d86f8a
Don't rustfmt author test
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-05-28 15:34:25 +02:00
Oliver Scherer
f98e4bd33b
Fix Block dump in author lint 2019-05-28 13:01:11 +02:00
bors
d57845ffdf Auto merge of #4071 - matthiaskrgr:sizeof, r=flip1995
trivially_copy_pass_by_ref: print size of type and limit in the lint message

changelog: trivially_copy_pass_by_ref: print size of type and limit in the lint message
2019-05-28 07:56:04 +00:00
bors
7b501f0f6a Auto merge of #4137 - euclio:let-return, r=oli-obk
tweak `let_and_return` diagnostic

changelog: `let_and_return`: label the unnecessary let binding and convert the note to a structured
suggestion
2019-05-27 13:04:14 +00:00
bors
eb0a2884d2 Auto merge of #4149 - flip1995:rollup-6knpdqb, r=flip1995
Rollup of 2 pull requests

Successful merges:

 - #4102 (Fix match_same_arms to fail late)
 - #4119 (Improve non ascii literal)

Failed merges:

r? @ghost
2019-05-27 11:33:29 +00:00
Philipp Krones
dce670c73c
Rollup merge of #4119 - BO41:non_ascii_literal, r=flip1995
Improve non ascii literal

This PR improves the example of the [non_ascii_literal](https://rust-lang.github.io/rust-clippy/master/index.html#non_ascii_literal) lint.
It also makes it auto-fixable.

Please review. This is my first PR to this project.
(Thanks @flip1995 for the help :)

changelog: none
fixes #4117
2019-05-27 13:09:17 +02:00
Philipp Krones
f0a767352b
Rollup merge of #4102 - Urriel:fix/4096_match_same_arms, r=flip1995
Fix match_same_arms to fail late

Changes:
- Add a function search_same_list which return a list of matched expressions
- Change the match_same_arms implementation behavior. It will lint each same arms found.

fixes #4096

changelog: none
2019-05-27 13:09:16 +02:00
bors
cf81a3b6d0 Auto merge of #3832 - HarrisonMc555:use_last, r=flip1995
Implement "Use last" lint

Closes #3673

This lint checks the use of `x.get(x.len() - 1)` and suggests `x.last()` (where `x` is a `Vec`).

There's at least one more thing that needs to happen here. I believe I am correctly checking most of the scenarios and avoiding false positives. However, if different `Vec`s are used for the `x.get` and `y.len`, then it will emit a false positive. In other words, I need to check to make sure the `Vec`s are the same.

Also, a lot of these commits were temporary and not helpful to the project history...am I supposed to squash on merge? If so, how do I do that?

changelog: New lint: `get_last_with_len`
2019-05-27 11:04:38 +00:00
Andy Russell
effea41fe4
tweak let_and_return diagnostic
Label the unnecessary let binding and convert the note to structured
suggestion.
2019-05-24 14:52:55 -04:00
Philipp Hansch
aca56727db
Rustup to https://github.com/rust-lang/rust/pull/59545 2019-05-24 08:19:51 +02:00
Matthias Krüger
5d58163f7d trivially_copy_pass_by_ref: print size of type and limit in the lint message 2019-05-23 23:48:20 +02:00
Philipp Hansch
a316179850
Rustup to https://github.com/rust-lang/rust/pull/60965 2019-05-23 20:19:00 +02:00
Matthias Krüger
3d0795bb04 tests: update needless_bool test stderr
I'm getting a test failure otherwise with rust master (f688ba6089).
2019-05-23 17:03:59 +02:00
Vincent Dal Maso
40f36658f5 Fix breaking tests
Changes:
- Fix stderr breaking the tests
- Adding tests over the if arms
2019-05-21 13:08:19 +02:00
Vincent Dal Maso
fa9f744c2c Add the common case search
Changes:
- Refactor the common case search into a function.
- Fix the useless Option around the vec in the search_same_list.
2019-05-21 13:08:19 +02:00
Harrison McCullough
f32c2fcb7e Implement get_last_with_len lint 2019-05-20 18:01:21 -06:00
Philipp Hansch
3f382999ab
Lifetimes UI test cleanup
* Removes an unneeded `#![warn(clippy::extra_unused_lifetimes)]` from
  the `needless_lifetimes` test - the tests for those are in a different
  file.

* Renames `unused_lt.{rs,stderr}` to `extra_unused_lifetimes.{rs,stderr}`
* Renames `lifetimes.{rs,stderr}` to `needless_lifetimes.{rs,stderr}`
2019-05-20 19:19:49 +02:00
BO41
36c8aaba8f Fix tests and make other ascii lints auto-fixable 2019-05-20 16:02:50 +02:00
Oliver Scherer
efac2e5eff Revert "Turn off two tests broken due to #4108"
This reverts commit 568a3ecfc3.
2019-05-20 12:31:53 +02:00
bors
fd56381015 Auto merge of #4088 - pJunger:check1, r=oli-obk
Added lint for TryFrom for checked integer conversion.

works towards #3947

Added lint for try_from for checked integer conversion.
Should recognize simple & straight-forward checked integer conversions.
2019-05-20 09:31:09 +00:00
bors
0417a0ac4d Auto merge of #4107 - taiki-e:useless_attribute, r=flip1995
useless_attribute: Add unreachable_pub to whitelists

Fixes #4106

changelog: `useless_attribute`: whitelist `unreachable_pub` on `use` items
2019-05-19 10:37:09 +00:00
bors
4071b2996e Auto merge of #4099 - flip1995:ul_4094, r=oli-obk
Add macro check for unreadable_literal lint

Closes #4094

changelog: Disable `unreadable_literal` lint inside macros
2019-05-19 08:46:43 +00:00
pJunger
00a5ef64a2 Added suggestion for conversion with is_ok. 2019-05-18 09:33:26 +02:00
pJunger
47444c44ad Added lint for TryFrom for checked integer conversion rust-lang#3947. 2019-05-18 09:33:25 +02:00
Taiki Endo
40fc725298 useless_attribute: Add unreachable_pub to whitelists 2019-05-18 14:22:16 +09:00
Oliver Scherer
568a3ecfc3 Turn off two tests broken due to #4108 2019-05-18 00:57:23 +02:00
flip1995
08d2a0d6b2
Also rename the lint in test files 2019-05-16 20:18:07 +02:00