Commit graph

9194 commits

Author SHA1 Message Date
bors
6220dff504 Auto merge of #5922 - flip1995:rustup, r=flip1995
Rustup

r? @ghost

changelog: none
2020-08-18 17:58:40 +00:00
flip1995
c680602005
Merge remote-tracking branch 'upstream/master' into rustup 2020-08-18 19:50:23 +02:00
bors
4b0e6d5b90 Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obk
rust_ast::ast => rustc_ast

Rework of #71199 which is a rework #70621

Still working on this but just made the PR to track progress

r? @Dylan-DPC
2020-08-17 23:16:08 +00:00
Ujjwal Sharma
ae0eb390b0 rust_ast::ast => rustc_ast 2020-08-17 20:32:32 +00:00
bors
9360ca6dc2 Auto merge of #5908 - giraffate:fix_fp_for_same_item_push, r=flip1995
Fix FP for `same_item_push`

Fixes https://github.com/rust-lang/rust-clippy/issues/5902

changelog: Fix FP for `same_item_push` where the pushed variable is mutated.
2020-08-17 16:49:03 +00:00
David Wood
f13d2bfd9b clippy: support QPath::LangItem
This commit updates clippy with the introduction of `QPath::LangItem` so
that it still compiles.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-17 13:55:05 +01:00
bors
838c201af9 Auto merge of #5915 - matthiaskrgr:deps_, r=Manishearth
deps: bump cargo_metadata and semver

cargo_metadata 0.9.1 -> 0.11.1
semver 0.9.0 -> 0.10.0

changelog: none
2020-08-17 12:23:44 +00:00
Matthias Krüger
262db3b5e6 deps: bump cargo_metadata and semver
cargo_metadata 0.9.1 -> 0.11.1
semver 0.9.0 -> 0.10.0
2020-08-17 12:19:32 +02:00
Takayuki Nakata
99ba290a14 Improve code style 2020-08-17 08:36:02 +09:00
bors
8332fe81d8 Auto merge of #5894 - tmiasko:self-assignment, r=Manishearth
Warn about explicit self-assignment

Warn about assignments where left-hand side place expression is the same
as right-hand side value expression. For example, warn about assignment in:

```rust
pub struct Event {
    id: usize,
    x: i32,
    y: i32,
}

pub fn copy_position(a: &mut Event, b: &Event) {
    a.x = b.x;
    a.y = a.y;
}
```

changelog: New lint `self_assignment`, checks for explicit self-assignments.
2020-08-16 21:56:37 +00:00
Tomasz Miąsko
4f4abf4e06 Warn about explicit self-assignment
Warn about assignments where left-hand side place expression is the same
as right-hand side value expression. For example, warn about assignment in:

```rust
pub struct Event {
    id: usize,
    x: i32,
    y: i32,
}

pub fn copy_position(a: &mut Event, b: &Event) {
    a.x = b.x;
    a.y = a.y;
}
```
2020-08-16 23:31:36 +02:00
Tomasz Miąsko
d1dbf7913a Expresions with Assign / AssignOp have side effects 2020-08-16 23:31:27 +02:00
Tomasz Miąsko
9b800b1e92 Rename SpanlessEq::ignore_fn to deny_side_effects
No functional changes intended.
2020-08-16 23:30:33 +02:00
Tomasz Miąsko
6afa4ef60f Introduce function for comparing expression values
Introduce `eq_expr_value(cx, a, b)` as a shortcut for
`SpanlessEq::new(cx).ignore_fn().eq_expr(cx, a, b)`.

No functional changes intended.
2020-08-16 23:30:33 +02:00
bors
8d0d89adc8 Auto merge of #5720 - bugadani:new-lint, r=flip1995,yaahc
Add unnecessary lazy evaluation lint

changelog: Add [`unnecessary_lazy_evaluations`] lint that checks for usages of `unwrap_or_else` and similar functions that can be simplified.

Closes #5715
2020-08-16 20:27:43 +00:00
Dániel Buga
fc1e07e0c1 Rename lint to use plural form 2020-08-16 22:16:39 +02:00
Dániel Buga
b175642a85 Fix missed rename 2020-08-16 21:33:29 +02:00
bors
5d723d0de1 Auto merge of #5913 - HactarCE:patch-1, r=flip1995
Fix typo in description of unnecessary_mut_passed

changelog: Correct "immutable reference" to "mutable reference" in description of `unnecessary_mut_passed`
2020-08-16 19:27:27 +00:00
Dániel Buga
b7ee8685ac Fix dogfooding test errors 2020-08-16 21:04:02 +02:00
Dániel Buga
3b52d7f780 run cargo dev fmt 2020-08-16 20:51:16 +02:00
Dániel Buga
8a14c11536 Cleanup, explain return value 2020-08-16 20:50:30 +02:00
Dániel Buga
d71b418ac5 Moved to submodule, don't trigger if map_unwrap_or does 2020-08-16 20:47:50 +02:00
Hactar
d8f0a14da1
Fix typo in description of unnecessary_mut_passed 2020-08-16 14:43:34 -04:00
Dániel Buga
9c41822d34 Apply suggested change
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-08-16 20:27:54 +02:00
Dániel Buga
94cf90e5a5 Apply suggested change
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-08-16 20:27:54 +02:00
Dániel Buga
a7083eea1c Removed the extra lifetime parameter 2020-08-16 20:27:54 +02:00
Dániel Buga
75637c1eda Catch function calls in argument lists, add tests that tuples don't get linted 2020-08-16 20:27:54 +02:00
Dániel Buga
d7220dbd91 Run cargo dev update_lints 2020-08-16 20:27:54 +02:00
Dániel Buga
a7cc5d4068 Also simplify if the closure body is an index expression 2020-08-16 20:27:54 +02:00
Dániel Buga
848af39310 Add note to or_fun_call, list checked methods 2020-08-16 20:27:54 +02:00
Dániel Buga
923d61222c Rename the changelog footnote as well 2020-08-16 20:27:22 +02:00
Dániel Buga
a3ea65c2d9 Implement new lint 2020-08-16 20:27:22 +02:00
bors
3bd98895f1 Auto merge of #5725 - montrivo:should-impl-trait, r=flip1995
should_impl_trait - ignore methods with lifetime params

Fixes: #5617

changelog: don't lint should_implement_trait when an `Iterator::next` case has explicit parameters
2020-08-16 17:51:18 +00:00
bors
78857cc9d3 Auto merge of #5907 - wiomoc:feature/useless-vec-max-size, r=flip1995
appreciative too_large_for_stack in useless `vec!`

Fixes: #5847
changelog: Add `too_large_for_stack ` configuration option for `USELESS_VEC`
2020-08-16 17:30:12 +00:00
bors
dff7e74b27 Auto merge of #5903 - jrqc:needless_return, r=ebroto,flip1995
Needless return

Fixes #5858
changelog: fix false positive [`needless_return`]
2020-08-16 17:08:45 +00:00
bors
c8e05fc1c6 Auto merge of #5881 - wiomoc:feature/single-char-push_str, r=ebroto,flip1995
Lint `push_str` with a single-character string literal

Fixes #5875
changelog:  `* [single_char_push_str]`
2020-08-16 16:41:57 +00:00
bors
e522ca3c8d Auto merge of #5831 - chansuke:to_string_in_display, r=flip1995
Don't use `to_string` in impl Display

fixes #3876

this PR is derived from [Toxyxer's implementation](https://github.com/rust-lang/rust-clippy/pull/5574).
changelog: add [`to_string_in_display`] lint
2020-08-16 16:21:37 +00:00
bors
f8db258b22 Auto merge of #5912 - ebroto:needless_doctest_main_improvements, r=Manishearth,flip1995
Parse doctests in needless_doctest_main

This switches from text-based search to running the parser to avoid false positives. Inspired by how [rustdoc](3f3250500f/src/librustdoc/test.rs (L366)) handles this and by #4729.

cc @llogiq

changelog: Fix multiple false positives in [`needless_doctest_main`].

Fixes #5879
Fixes #4906
Fixes #5103
Fixes #4698
2020-08-16 15:57:18 +00:00
Eduardo Broto
1a140dcc1c Improve needless_doctest_main by using the parser 2020-08-16 00:25:54 +02:00
jrqc
baa4cb1cdd early return removed 2020-08-16 00:24:27 +03:00
jrqc
96efaee552 cargo dev update_lints 2020-08-16 00:24:27 +03:00
jrqc
a7d5c2f967 Modifications according to the code review 2020-08-16 00:24:27 +03:00
jrqc
cd6ca72e0e Known problems changed 2020-08-16 00:24:27 +03:00
jrqc
65d10c7abf Borrow checker added 2020-08-16 00:24:27 +03:00
jrqc
85f4ef0fbd Visitor added 2020-08-16 00:24:27 +03:00
jrqc
6d18fe730e Make needless_return a late lint pass 2020-08-16 00:24:27 +03:00
bors
f0cc006964 Auto merge of #5910 - flip1995:rustup, r=flip1995
Rustup

r? @ghost

changelog: none
2020-08-15 12:05:11 +00:00
Christoph Walcher
b381ade179
elide lifetimes 2020-08-15 01:40:55 +02:00
Christoph Walcher
ae56e988a2
Merge lint with single_char_pattern 2020-08-15 01:40:55 +02:00
Christoph Walcher
72d2c2eab4
Lint push_str with a single-character string literal
Fixes #5875
2020-08-15 01:40:55 +02:00