bors
ad7a03cbaa
Auto merge of #5951 - ThibsG:FixMacroCloneOnRefPtr2076, r=ebroto
...
Fix incorrect suggestion when `clone_on_ref_ptr` is triggered in macros
In the lint `clone_on_ref_ptr`, if the `span` is in a macro, don't expand it for suggestion.
Fixes : #2076
changelog: none
r? @ebroto
2020-08-25 21:48:19 +00:00
Thibaud
370fc45a0a
Update clippy_lints/src/methods/mod.rs
...
Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
2020-08-25 22:20:35 +02:00
Scott McMurray
3b1e5d6ff7
Re-enable len_zero for ranges now that is_empty
is stable on them
2020-08-25 12:17:03 -07:00
bors
f9015592f3
Auto merge of #5952 - 1c3t3a:1c3t3a-dev-5819, r=Manishearth
...
Added a lint which corrects expressions like (a - b) < f32::EPSILON, according to #5819
Fixes #5819
changelog: none
2020-08-25 16:54:48 +00:00
Bastian
179df0bd15
Added F32::EPSILON and F64::EPSILON to paths.rs
2020-08-25 13:41:39 +02:00
bors
64b53f3877
Auto merge of #5920 - giraffate:fix_fp_for_redundant_closure_call, r=mikerite
...
Fix FP for `redundant_closure_call`
Fix #5916
changelog: Fix FP for `redundant_closure_call` when called in function body
2020-08-25 03:29:59 +00:00
Matthias Krüger
e9964f2e8a
stable_sort_primitive: print the type that is being sorted in the lint message
2020-08-24 20:06:43 +02:00
Bastian
680c68153b
Added a lint which corrects expressions like (a - b) < f32::EPSILON
2020-08-24 16:31:51 +02:00
ThibsG
3d820f71fe
Fix incorrect suggestion when clone_on_ref_ptr
is triggered in macros
2020-08-24 14:05:49 +02:00
Takayuki Nakata
9fe0ac36a5
Avoid period in lint message according to convention
2020-08-24 10:11:53 +09:00
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
8776db9f6d
Fix ICE in repeat_once
lint
2020-08-23 12:05:34 +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
Christian Stefanescu
e615a26ae4
Use more elegant way to check for prelude string
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
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
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
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
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
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
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
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