Commit graph

5007 commits

Author SHA1 Message Date
Markus Legner
e42a18f02a
Run cargo dev fmt. 2020-11-27 08:55:04 +01:00
Markus Legner
82a7068007
Trigger modulo_one lint also on -1. 2020-11-27 08:54:35 +01:00
Takayuki Nakata
e91d15f42d cargo dev fmt 2020-11-27 10:32:44 +09:00
Takayuki Nakata
0924d6286a Merge remote-tracking branch 'upstream/master' into sync-from-rust 2020-11-27 10:25:07 +09:00
bors
403816fbc9 Auto merge of #6362 - nico-abram:unnecessary_cast_dot_float_literal, r=ebroto
Fix rust-lang/rust#79255 - Incorrect try suggestion for float cast

changelog: Fix rust-lang/rust#79255 - Incorrect try suggestion for float literal cast ending in dot
2020-11-26 08:41:16 +00:00
unknown
3b53de6b36 Fix rust-lang/rust#79255 - Incorrect try suggestion for unnecessary float literal cast ending in dot 2020-11-25 19:38:55 -03:00
PunitLodha
2345ef5b1f added lints str_to_string and string_to_string 2020-11-25 20:59:29 +05:30
flip1995
93f922a858
Add note where the first definition of msrv attr is 2020-11-25 12:23:28 +01:00
flip1995
b2e2c0806e
Improve extract_msrv_attr! situation 2020-11-25 12:22:58 +01:00
Suyash458
aaa4325045
add support for minimum supported rust version.
add configuration option for minimum supported rust version
add msrv attribute to some lints listed in #6097
add tests
2020-11-25 12:22:47 +01:00
Arlie Davis
f6827839c0 Move lev_distance to rustc_ast, make non-generic
rustc_ast currently has a few dependencies on rustc_lexer. Ideally, an AST
would not have any dependency its lexer, for minimizing unnecessarily
design-time dependencies. Breaking this dependency would also have practical
benefits, since modifying rustc_lexer would not trigger a rebuild of rustc_ast.

This commit does not remove the rustc_ast --> rustc_lexer dependency,
but it does remove one of the sources of this dependency, which is the
code that handles fuzzy matching between symbol names for making suggestions
in diagnostics. Since that code depends only on Symbol, it is easy to move
it to rustc_span. It might even be best to move it to a separate crate,
since other tools such as Cargo use the same algorithm, and have simply
contain a duplicate of the code.

This changes the signature of find_best_match_for_name so that it is no
longer generic over its input. I checked the optimized binaries, and this
function was duplicated at nearly every call site, because most call sites
used short-lived iterator chains, generic over Map and such. But there's
no good reason for a function like this to be generic, since all it does
is immediately convert the generic input (the Iterator impl) to a concrete
Vec<Symbol>. This has all of the costs of generics (duplicated method bodies)
with no benefit.

Changing find_best_match_for_name to be non-generic removed about 10KB of
code from the optimized binary. I know it's a drop in the bucket, but we have
to start reducing binary size, and beginning to tame over-use of generics
is part of that.
2020-11-24 16:12:23 -08:00
bors
f897d27d8b Auto merge of #6339 - CDirkx:redundant-pattern-match-poll, r=ebroto
Change `redundant_pattern_matching` to also lint `std::task::Poll`

`reduntant_pattern_matching` currently lints pattern matching on `Option` and `Result` where the `is_variant` utility methods could be used instead: `is_some`, `is_none`, `is_ok`, `is_err`. This PR extends this behaviour to `std::task::Poll`, suggesting the methods `is_pending` and `is_ready`.

Motivation: The current description of `redundant_pattern_matching` mentions

> It's more concise and clear to just use the proper utility function

which in my mind applies to `Poll` as well.

changelog: Enhance [`redundant_pattern_matching`] to also lint on `std::task::Poll`
2020-11-24 23:19:43 +00:00
flip1995
c6a577ea11
Merge remote-tracking branch 'upstream/master' into rustup 2020-11-24 17:05:01 +01:00
bors
53ce1dd719 Auto merge of #79228 - flip1995:clippyup, r=oli-obk
Update Clippy

Biweekly Clippy update

r? `@Manishearth`
2020-11-24 06:56:02 +00:00
bors
295fe28057 Auto merge of #6313 - giraffate:fix_fp_needless_collect, r=ebroto
Fix FP in indirect `needless_collect` when used multiple times

Fix https://github.com/rust-lang/rust-clippy/issues/5991
Fix https://github.com/rust-lang/rust-clippy/issues/6297

changelog: Fix FP in indirect `needless_collect` when used multiple times
2020-11-23 22:26:45 +00:00
Eduardo Broto
209ab1885c Merge remote-tracking branch 'upstream/master' into rustup 2020-11-23 23:02:12 +01:00
bors
e5fddb6747 Auto merge of #78439 - lzutao:rm-clouldabi, r=Mark-Simulacrum
Drop support for all cloudabi targets

`cloudabi` is a tier-3 target, and [it is no longer being maintained upstream][no].

This PR drops supports for cloudabi targets. Those targets are:
* aarch64-unknown-cloudabi
* armv7-unknown-cloudabi
* i686-unknown-cloudabi
* x86_64-unknown-cloudabi

Since this drops supports for a target, I'd like somebody to tag `relnotes` label to this PR.

Some other issues:
* The tidy exception for `cloudabi` crate is still remained because
  * `parking_lot v0.9.0` and `parking_lot v0.10.2` depends on `cloudabi v0.0.3`.
  * `parking_lot v0.11.0` depends on `cloudabi v0.1.0`.

[no]: https://github.com/NuxiNL/cloudabi#note-this-project-is-unmaintained
2020-11-23 19:01:19 +00:00
flip1995
284c359c61 Fix ICE in utils::implements_trait
This only happend when debug_assertions were enabled in rustc
2020-11-23 13:52:27 +01:00
flip1995
d3d2018ead Merge commit '3e7c6dec244539970b593824334876f8b6ed0b18' into clippyup 2020-11-23 13:51:04 +01:00
Cameron Steffen
a39a93faeb Disable unnecessary_cast for cfg-dependant types 2020-11-22 19:35:04 -06:00
Lzu Tao
4b698f2069 Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00
Carol (Nichols || Goulding)
445466e567
Apply suggestions from code review to change "that" to "which"
Co-authored-by: oliver <16816606+o752d@users.noreply.github.com>
2020-11-22 10:17:34 -05:00
Carol (Nichols || Goulding)
034244f108
Small grammar, punctuation, and code style improvements to docs 2020-11-22 10:17:34 -05:00
oliver
9b910e19ce
a typo
typo
2020-11-22 04:44:47 +00:00
Jonas Schievink
1464dcedfb Thread Constness through selection 2020-11-22 02:13:53 +01:00
Daniel Smith
8b21241fd5 Revert "Convert the await holding lints to correctness"
This reverts commit d8c6bce440.
2020-11-20 11:44:26 -05:00
bors
8325d48d2d Auto merge of #6351 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2020-11-20 09:07:56 +00:00
flip1995
5ee0a400fc
Fix dogfood errors 2020-11-20 10:06:26 +01:00
flip1995
dd4e471b3f
Properly deprecate panic_params lint 2020-11-20 09:37:47 +01:00
Mara Bos
113c1476c9 Clippy: Match on assert!() expansions without an inner block. 2020-11-19 19:47:25 +01:00
Mara Bos
78faaef8de Remove the clippy::panic-params lint.
Rustc itself now warns for all cases that triggered this lint.
2020-11-19 18:34:40 +01:00
Mara Bos
577ebc8cd6 Rollup merge of #79145 - camelid:clippy-fix-panics, r=flip1995
Fix handling of panic calls

This should make Clippy more resilient and will unblock #78343.

This PR is made against rust-lang/rust to avoid the need for a subtree
sync at ``@flip1995's`` suggestion in rust-lang/rust-clippy#6310.

r? ``@flip1995``
cc ``@m-ou-se``
2020-11-18 15:46:36 +01:00
Takayuki Nakata
0502ac2a87 Improve doc about map_clone 2020-11-18 08:33:25 +09:00
Christiaan Dirkx
5a83968877 Change redundant_pattern_matching to also lint std::task::Poll
Suggest using utility methods `is_pending` and `is_ready`.
2020-11-17 23:40:31 +01:00
bors
44d944586c Auto merge of #6070 - matsujika:unnecessary_wrap, r=flip1995
Add new lint `unnecessary_wrap`

Fixes #5969

changelog: New lint [`unnecessary_wraps`]
2020-11-17 20:28:32 +00:00
Camelid
4e4c4fb8aa Fix handling of panic calls
This should make Clippy more resilient and will unblock #78343.

This PR is made against rust-lang/rust to avoid the need for a subtree
sync at @flip1995's suggestion in rust-lang/rust-clippy#6310.
2020-11-17 12:16:15 -08:00
bors
5464cbed2f Auto merge of #6337 - ThibsG:FixIce6332, r=Manishearth
Remove `expect()` calls to avoid ICEs in `deref_addrof` lint

Fixes: #6332

changelog: none
2020-11-17 17:55:46 +00:00
bors
a8cafc6196 Auto merge of #6338 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2020-11-17 17:10:04 +00:00
flip1995
bf2d31d053
Run cargo dev fmt 2020-11-17 18:08:12 +01:00
Hirochika Matsumoto
c7445d7f2c Pluralize lint name 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
4e5c02e898 Ignore trait implementations 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
bf46f78ca7 Fix clippy error 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
532d205218 Skip functions in PartialOrd 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
9d96311d73 Remove wildcard use 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
e998d61fe6 Downgrade applicability to MaybeIncorrect 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
c7692cf749 Skip function with no exprs contained 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
c5447eb3c1 Make lint skip macros 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
12474c62ff Add support for methods 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
2f85aa736e Make lint skip closures 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
8392bc7946 Run cargo dev fmt 2020-11-18 01:28:37 +09:00