Commit Graph

9375 Commits

Author SHA1 Message Date
Takayuki Nakata
b2c2266792 Fix FP for redundant_closure_call
Visit the nested things like function body when checking closure call.
2020-08-24 09:43:16 +09:00
Eduardo Broto
b05077ea75 Apply suggestions from PR review 2020-08-23 22:20:55 +02:00
bors
27ae4d303c Auto merge of #5948 - ebroto:5944_repeat_ice, r=Manishearth
Fix ICE in `repeat_once`

changelog: Fix ICE in [`repeat_once`]

Fixes #5944
2020-08-23 14:13:58 +00:00
bors
2d86cc5a33 Auto merge of #5930 - ebroto:dev_newlint_fix_lt, r=matthiaskrgr
Fix cargo dev new_lint for late lint passes

Since 30c046ede4, `LateLintPass` has only one lifetime parameter.

I'm not sure how to easily test this, I think adding this kind of tests would be probably part of #5394

changelog: none
2020-08-23 10:59:53 +00:00
rail
91b200c62b Fix fp in borrow_interior_mutable_const
Fix false positive when referencing a field behind a pointer.
2020-08-23 22:49:08 +12:00
Eduardo Broto
8776db9f6d Fix ICE in repeat_once lint 2020-08-23 12:05:34 +02:00
Eduardo Broto
eb8ede7f65 Improve documentation related to the sync process 2020-08-23 11:33:59 +02:00
Eduardo Broto
6dd65b8e6a Fix cargo dev new_lint for late lint passes 2020-08-23 10:14:09 +02:00
Michael Wright
e8d33d73dc Fix let_and_return bad suggestion
Add a cast to the suggestion when the return expression has adjustments.
These adjustments are lost when the suggestion is applied.

This is similar to the problem in issue #4437.

Closes #5729
2020-08-23 07:50:59 +02:00
bors
dd07860b83 Auto merge of #5941 - ThibsG:InlineInCopyPassByRef, r=yaahc
Don't lint if it has always inline attribute

Don't trigger the lint `trivially_copy_pass_by_ref` if it has `#[inline(always)]` attribute.

Note: I am not particularly familiar with `inline` impacts, so I implemented this the way that if only `#[inline]` attribute is here (without `always`), the lint will still trigger. Also, it will still trigger if it has `#[inline(never)]`.
Just tell me if it sounds too much conservative.

Fixes: #5876

changelog: none
2020-08-22 18:30:39 +00:00
bors
f21d10b970 Auto merge of #5929 - stchris:issues/5917, r=ebroto
Widen understanding of prelude import

Prelude imports are exempt from wildcard import warnings. Until now only
imports of the form

```
use ...::prelude::*;
```

were considered. This change makes it so that the segment `prelude` can
show up anywhere, for instance:

```
use ...::prelude::v1::*;
```

Fixes #5917

changelog: Allow `prelude` to appear in any segment of the import path in [`wildcard_imports`]
2020-08-22 12:50:22 +00:00
Christian Stefanescu
e615a26ae4 Use more elegant way to check for prelude string 2020-08-22 14:22:02 +02:00
Christian Stefanescu
53508aeb65 Run sh tests/ui/update-all-references.sh 2020-08-22 14:22:02 +02:00
Christian Stefanescu
5b07b9ed61 Widen understanding of prelude import
Prelude imports are exempt from wildcard import warnings. Until now only
imports of the form

```
use ...::prelude::*;
```

were considered. This change makes it so that the segment `prelude` can
show up anywhere, for instance:

```
use ...::prelude::v1::*;
```

Fixes #5917
2020-08-22 14:22:02 +02:00
ThibsG
191b6c798f Don't lint if it has always inline attribute 2020-08-22 12:58:35 +02:00
bors
a8520b0636 Auto merge of #5934 - ThibsG:WrongSelfTestCase4037, r=ebroto
Add async test case for FP in `wrong_self_convention` lint

Closes: #4037

changelog: none

r? @ebroto
2020-08-22 06:19:42 +00:00
ThibsG
03bc7aed44 Add async test case for wrong_self_convention lint 2020-08-22 08:14:42 +02:00
bors
b57ef14290 Auto merge of #5926 - giraffate:improve_lint_message_in_to_string_in_display, r=yaahc
Improve lint message in `to_string_in_display`

This is a follow-up of https://github.com/rust-lang/rust-clippy/pull/5831.

changelog: none
2020-08-22 04:51:38 +00:00
bors
aa3b04ff74 Auto merge of #5933 - mikerite:fix-5927, r=matthiaskrgr
Fix false negative in `option_as_ref_deref`

Closes #5927

changelog: Fix false negative in `option_as_ref_deref`
2020-08-21 23:43:20 +00:00
bors
1a26dbff22 Auto merge of #5938 - ebroto:sync-from-rust, r=ebroto
Rustup

r? @ghost

changelog: none
2020-08-21 23:10:59 +00:00
Eduardo Broto
146e352db4 run cargo dev fmt 2020-08-22 00:59:42 +02:00
Eduardo Broto
c2799c861d Merge remote-tracking branch 'upstream/master' into sync-from-rust 2020-08-22 00:53:03 +02:00
Michael Wright
11efd75aeb Fix false negative in option_as_ref_deref 2020-08-21 07:23:04 +02:00
Tim Nielens
2ecc2ac864 unit-arg - improve suggestion 2020-08-21 00:42:11 +02:00
bors
4104611913 Auto merge of #5928 - mikerite:fix-5924, r=ebroto
Fix false positive in `PRECEDENCE` lint

Extend the lint to handle chains of methods combined with unary negation.

Closes #5924

changelog: Fix false negative in `PRECEDENCE` lint
2020-08-20 22:09:27 +00:00
bors
d891954293 Auto merge of #5919 - ebroto:5747_from_bits_in_const, r=matthiaskrgr
transmute: avoid suggesting from/to bits in const

changelog: Avoid suggesting from/to bits in const contexts in [`transmute_int_to_float`]

Fixes #5747
2020-08-20 10:04:46 +00:00
Aaron Hill
191b0806d2 Capture tokens for Pat used in macro_rules! argument
This extends PR #73293 to handle patterns (Pat). Unlike expressions,
patterns do not support custom attributes, so we only need to capture
tokens during macro_rules! argument parsing.
2020-08-20 02:45:28 -04:00
Michael Wright
c236c0fb56 Fix false positive in PRECEDENCE lint
Extend the lint to handle chains of methods combined with unary negation.

Closes #5924
2020-08-20 06:34:48 +02:00
Takayuki Nakata
902b28275e Improve lint message in to_string_in_display 2020-08-19 22:31:34 +09:00
Eduardo Broto
6a12bae194 no from/to bits in const: add tests cases for f64 2020-08-18 22:19:30 +02:00
Eduardo Broto
df4d42fc2d transmute: avoid suggesting from/to bits in const 2020-08-18 21:55:56 +02:00
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