Commit graph

8821 commits

Author SHA1 Message Date
Thiago Arrais
db7bc6b3bd Place radian lints under suboptimal_flops 2020-07-06 13:45:43 -03:00
Thiago Arrais
f5596826fa Better copy for lint message
Since x.log(y) is actually implemented as x.ln() / y.ln()
2020-07-06 13:45:43 -03:00
Thiago Arrais
076ec872ce Lint for to_radians and to_degrees 2020-07-06 13:45:39 -03:00
Thiago Arrais
0c8afa39ce Lint x.log(b) / y.log(b) => x.log(y) 2020-07-06 13:32:31 -03:00
Thiago Arrais
f62798454c Lint (x * x + y * y).sqrt() => x.hypot(y) 2020-07-06 13:23:17 -03:00
Thiago Arrais
a6f1af75d7 Lint for x.powi(2) => x * x 2020-07-06 13:23:17 -03:00
bors
57cdf2dc16 Auto merge of #4841 - phaylon:pattern-type-mismatch, r=flip1995
Added restriction lint: pattern-type-mismatch

changelog: Added a new restriction lint `pattern-type-mismatch`. This lint is especially helpful for beginners learning about the magic behind pattern matching. (This explanation might be worth to include in the next changelog.)
2020-07-03 16:41:26 +00:00
Robert Sedlacek
c0fd452840 fmt fix 2020-07-03 18:23:36 +02:00
Robert Sedlacek
aa4bee228f LateContext has only one lifetime parameter now 2020-07-03 18:20:19 +02:00
bors
fff8e72913 Auto merge of #5761 - ThibsG:TypeRepetitionThreshold, r=flip1995
Improvements for `type_repetition_in_bounds` lint

Some improvements for `type_repetition_in_bounds`:
- add a configurable threshold to trigger the lint (#4380). The lint won't trigger anymore if there are more bounds (strictly) than `conf.max_trait_bounds` on this type.
- take generic args into account over bounded type (#4323)
- don't lint for predicates generated in macros (#4326)

Fixes #4380,
Fixes #4323,
Fixes #4326,
Closes #3764

changelog: Fix multiple FPs in `type_repetition_in_bounds` and add a configuration option

Note: the #3764 has already been fixed but not closed
2020-07-03 16:17:41 +00:00
Robert Sedlacek
d617551a6a Expanded lint documentation 2020-07-03 18:12:29 +02:00
Robert Sedlacek
92ecc53691 Catching up with rustc changes 2020-07-03 18:12:29 +02:00
flip1995
6447507ab1 Fix rebase fallout 2020-07-03 18:12:29 +02:00
Robert Sedlacek
346ee968bb Adjusted expected STDERR 2020-07-03 18:12:29 +02:00
Robert Sedlacek
55877d7b4a span_help_and_lint -> span_lint_and_help 2020-07-03 18:12:29 +02:00
Robert Sedlacek
c3c402783f Added restriction lint: pattern-type-mismatch 2020-07-03 18:12:29 +02:00
ThibsG
2d5930a3da Don't lint for predicates generated in macros 2020-07-03 17:29:54 +02:00
ThibsG
d5a8f03a35 Take generic args into account for bounded type 2020-07-03 17:29:54 +02:00
ThibsG
754bfb1dc8 Add configurable threshold for type_repetition_in_bounds lint 2020-07-03 17:29:54 +02:00
bors
c493090a8a Auto merge of #5763 - flip1995:rustup, r=Manishearth
Rustup

changelog: none
2020-07-03 14:48:59 +00:00
flip1995
a7c58e66d4
Merge remote-tracking branch 'upstream/master' into rustup 2020-07-03 12:50:41 +02:00
Eduard-Mihai Burtescu
30c046ede4 Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
Eduard-Mihai Burtescu
590e07bbc2 rustc_lint: avoid using TypeckTables::empty for LateContext. 2020-07-02 16:51:04 +03:00
bors
52cc5fce1e Auto merge of #5760 - phansch:deprecate-regex-macro, r=Manishearth
Deprecate regex_macro lint

Closes #2586

changelog: Deprecate regex_macro lint
2020-07-01 14:50:53 +00:00
Philipp Hansch
d347d0cf59
Deprecate regex_macro lint 2020-07-01 13:05:41 +02:00
bors
0860375664 Auto merge of #5759 - mikerite:multiple_crate_versions_20200701, r=matthiaskrgr
Fix multiple_crate_versions error

Fix the versions of packages in the multiple_crate_versions ui test by
checking in the Cargo.lock for the test package. `ansi_term 0.11`
depends on `winapi ^0.3.4`. This means means that the expected stderr for
this test would have to be updated whenever `winapi 0.3` is updated
otherwise.

changelog: none
2020-07-01 08:13:52 +00:00
Michael Wright
5b9c2ff9cc Fix multiple_crate_versions error
Fix the versions of packages in the multiple_crate_versions ui test by
checking in the Cargo.lock for the test package. `ansi_term 0.11`
depends on `winapi ^0.3.4`. This means means that the expected stderr for
this test would have to be updated whenever `winapi 0.3` is updated
otherwise.
2020-07-01 07:35:18 +02:00
bors
36b7983580 Auto merge of #5758 - ebroto:5704_unnested_or_pats, r=flip1995
Require `or_patterns` to suggest nesting them

changelog: Require `#![feature(or_patterns)]` to trigger [`unnested_or_patterns`]

Fixes #5704
2020-06-30 22:23:23 +00:00
Eduardo Broto
bff6c435ef Require or_patterns to suggest nesting them 2020-07-01 00:15:21 +02:00
bors
d05d6abf89 Auto merge of #5750 - ebroto:blanket_clippy_restriction_lints, r=Manishearth,flip1995,phansch,oli-obk
Lint enabling the whole restriction group

I've added it to the `correctness` category, but I may be missing some valid use cases. In that case it could be changed to `pedantic`.

changelog: Add [`blanket_clippy_restriction_lints`] to check against enabling the whole restriction group.
2020-06-30 21:55:46 +00:00
Eduardo Broto
c5d8f530e0 Move blanket_clippy_restriction_lints to "style" 2020-06-30 21:56:19 +02:00
Eduardo Broto
814349f941 Lint enabling the whole restriction group 2020-06-30 21:56:19 +02:00
bors
ccf7cb3764 Auto merge of #5751 - flip1995:rustup, r=Manishearth,flip1995
Rustup

cc https://github.com/rust-lang/rust/pull/73743

r? @Manishearth

changelog: none
2020-06-30 14:20:09 +00:00
flip1995
ab649c920e
Disable chrono integration test 2020-06-30 16:19:42 +02:00
flip1995
1e861a2663
Merge remote-tracking branch 'upstream/master' into rustup2 2020-06-30 15:40:22 +02:00
Dylan MacKenzie
3c5ee3300f Update tests 2020-06-28 10:08:12 -07:00
bors
81810fa8f4 Auto merge of #73756 - Manishearth:rollup-aehswb2, r=Manishearth
Rollup of 13 pull requests

Successful merges:

 - #72620 (Omit DW_AT_linkage_name when it is the same as DW_AT_name)
 - #72967 (Don't move cursor in search box when using arrows to navigate results)
 - #73102 (proc_macro: Stop flattening groups with dummy spans)
 - #73297 (Support configurable deny-warnings for all in-tree crates.)
 - #73507 (Cleanup MinGW LLVM linkage workaround)
 - #73588 (Fix handling of reserved registers for ARM inline asm)
 - #73597 (Record span of `const` kw in GenericParamKind)
 - #73629 (Make AssocOp Copy)
 - #73681 (Update Chalk to 0.14)
 - #73707 (Fix links in `SliceIndex` documentation)
 - #73719 (emitter: column width defaults to 140)
 - #73729 (disable collectionbenches for android)
 - #73748 (Add code block to code in documentation of `List::rebase_onto`)

Failed merges:

r? @ghost
2020-06-26 10:11:43 +00:00
Manish Goregaokar
a671ea4d3f Rollup merge of #73597 - ayazhafiz:i/const-span, r=ecstatic-morse
Record span of `const` kw in GenericParamKind

Context: this is needed for a fix of https://github.com/rust-lang/rustfmt/issues/4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated 🙂
2020-06-26 00:39:08 -07:00
Eduard-Mihai Burtescu
f5ce0e5fe9 rustc_lint: only query typeck_tables_of when a lint needs it. 2020-06-26 02:56:23 +03:00
bors
88fec89c16 Auto merge of #5748 - carols10cents:tiny-docs-fix, r=flip1995
Change a noun to a verb to make the sentence complete

changelog: Fixed some grammar in the documentation for `await_holding_lock`.

Just a tiny little thing I found while using clippy <3
2020-06-25 15:28:50 +00:00
Carol (Nichols || Goulding)
fa0f1d3e53
Change a noun to a verb to make the sentence complete 2020-06-25 11:25:21 -04:00
bors
46d33043d5 Auto merge of #5701 - ebroto:4874_cmp_owned_fp, r=flip1995
cmp_owned: handle when PartialEq is not implemented symmetrically

changelog: Handle asymmetrical implementations of PartialEq in [`cmp_owned`].

Fixes #4874
2020-06-24 12:48:24 +00:00
bors
a14eab389f Auto merge of #5745 - montrivo:copy_on_clone, r=phansch
clone_on_copy - add machine applicability

Fix #4826.
Change the applicability of the lint clone_on_copy. Split a test file and run rustfix on the clone_on_copy part.

changelog: clone_on_copy - add machine applicability
2020-06-24 07:11:07 +00:00
Tim Nielens
6bf5434e19 copy_on_clone - add machine applicability 2020-06-24 01:01:44 +02:00
Eduardo Broto
b498e1d715 cmp_owned: reverse operands if necessary 2020-06-23 22:14:45 +02:00
Eduardo Broto
5987c7d404 cmp_owned: avoid FP when PartialEq is not implemented symmetrically 2020-06-23 22:14:45 +02:00
Ayaz Hafiz
7c1b3aa0dd Record span of const kw in GenericParamKind
Context: this is needed to fix https://github.com/rust-lang/rustfmt/issues/4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated 🙂
2020-06-23 09:25:46 -07:00
bors
583d644934 Auto merge of #5694 - wangtheo:issue-5626, r=matthiaskrgr
#5626: lint iterator.map(|x| x)

changelog: adds a new lint for iterator.map(|x| x) (see https://github.com/rust-lang/rust-clippy/issues/5626)

The code also lints for result.map(|x| x) and option.map(|x| x). Also, I'm not sure if I'm checking for type adjustments correctly and I can't think of an example where .map(|x| x) would apply type adjustments.
2020-06-23 15:59:27 +00:00
Teddy_Wang
fb4f9a0ad7 Fix pattern match of ExprKind::MethodCall 2020-06-23 11:40:38 -04:00
flip1995
80bcbf521c Merge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup 2020-06-23 17:05:22 +02:00