Commit Graph

9271 Commits

Author SHA1 Message Date
Taiki Endo
2e4b4cebbb useless_attribute: Permit wildcard_imports and enum_glob_use 2020-09-01 12:09:32 +09:00
bors
001c1c51d2 Auto merge of #5984 - ebroto:5693_const_assoc_fn, r=flip1995
or_fn_call: ignore nullary associated const fns

The fix in #5889 was missing associated functions.

changelog: Ignore also `const fn` methods in [`or_fun_call`]

Fixes #5693
2020-08-31 10:43:58 +00:00
bors
ab64d47c03 Auto merge of #5988 - camelid:patch-2, r=ebroto
Syntax-highlight `single_char_push_str` lint

It wasn't being syntax highlighted in the online lint index:

![image](https://user-images.githubusercontent.com/37223377/91666682-8fc02000-eab3-11ea-95fa-6671472712c8.png)

changelog: none
2020-08-30 20:21:00 +00:00
Camelid
17b2ba5ded Syntax-highlight single_char_push_str lint 2020-08-30 11:29:17 -07:00
Eduardo Broto
7a66e6502d or_fn_call: ignore nullary associated const fns 2020-08-29 01:20:49 +02:00
bors
c88c614941 Auto merge of #5970 - ebroto:changelog_beta_1_47, r=flip1995
Update changelog to beta 1.47

[Rendered](https://github.com/ebroto/rust-clippy/blob/changelog_beta_1_47/CHANGELOG.md)

changelog: none
2020-08-28 13:08:29 +00:00
bors
3d0b0e66af Auto merge of #5774 - ThibsG:FixNewRetNoSelf, r=ebroto
Fix FP in `new_ret_no_self`: trigger in trait def instead of impl block

Lint in trait def instead of impl block.

Fixes: #5435

changelog: none
2020-08-28 11:54:07 +00:00
Thibaud
73b1ee1a61
Update clippy_lints/src/methods/mod.rs
Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
2020-08-28 09:33:05 +02:00
Thibaud
ffaadae8e4
Update clippy_lints/src/utils/mod.rs
Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
2020-08-28 09:31:29 +02:00
Thibaud
e8be047c5b
Update clippy_lints/src/utils/mod.rs
Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
2020-08-28 09:31:12 +02:00
bors
07c5e9edb5 Auto merge of #5971 - giraffate:fix_fp_in_to_string_in_display, r=ebroto
Fix FP in `to_string_in_display`

Don't emit a lint when `.to_string()` on anything that is not `self`

Fix #5967

changelog: Fix FP in `to_string_in_display` when calling `.to_string()` on anything that is not `self`
2020-08-27 23:26:52 +00:00
ThibsG
504612622f Merge logic of looking for Self type 2020-08-27 18:31:31 +02:00
ThibsG
3cb75c2e5c Remove expansion restriction + fix doc and tests naming 2020-08-27 18:25:38 +02:00
ThibsG
2a3ee5fa85 Fix FP in new_ret_no_self: trigger in trait def instead of impl block 2020-08-27 18:25:38 +02:00
Takayuki Nakata
04bff17668 Fix FP in to_string_in_display
Don't emit a lint when `.to_string()` on anything that is not `self`
2020-08-27 23:37:47 +09:00
Eduardo Broto
baf62e7a38 Update changelog to beta 1.47 2020-08-27 14:48:07 +02:00
bors
dead45fd5b Auto merge of #5957 - xvschneider:AddUnwrapInsideResultLint, r=yaahc
Adding new lint to prevent usage of 'unwrap' inside functions that re…

### Change
Adding a new lint that will emit a warning when using "unwrap" or "expect" inside a function that returns result.
### Motivation
These functions promote recoverable errors to non-recoverable errors which may be undesirable in code bases which wish to avoid panics.
### Test plan
Running:
`TESTNAME=unwrap_in_result cargo uitest
`---

changelog: none
2020-08-26 23:38:34 +00:00
Jane Lusby
91024f1fde Add new lint to prevent usage of unwrap in fns that return result 2020-08-26 16:31:49 -07:00
bors
e45c59e922 Auto merge of #5968 - rail-rain:fix_use_snippet_with_applicability, r=flip1995
Fix the wrong use of `snippet_with_applicability`

For the context, please see https://github.com/rust-lang/rust-clippy/issues/5822#issuecomment-680749728 and https://github.com/rust-lang/rust-clippy/issues/5822#issuecomment-680783381.

---

changelog: none
2020-08-26 22:52:47 +00:00
rail
edc05da57d Fix the wrong use of snippet_with_applicability
This includes a workaround of the issue #5822,
the cause of this little mistake.
2020-08-27 10:24:16 +12:00
bors
64c4bb0d2b Auto merge of #5966 - 1c3t3a:1c3t3a-dev-5819-fix, r=Manishearth
Corrects the float_equality_without_abs lint

Fixes an issue in the `float_equality_without_abs` lint. The lint suggestion was configured in a way that it lints the whole error and not just the subtraction part. In the current configuration the lint would suggest to change the expression in a wrong way, e.g.
```rust
let _ = (a - b) < f32::EPSILON; // before
let _ = (a - b).abs(); // after
```
This was dicovered by @flip1995. (See discussion of PR #5952).

Also the suggestion is now formatted via `utils::sugg`.
changelog: none
2020-08-26 18:15:42 +00:00
Bastian
2d853148d7 Changed the location of the suggestion as well as the way the suggestion is assembled 2020-08-26 16:39:30 +02:00
bors
894581b872 Auto merge of #5946 - mikerite:fix-5729, r=flip1995
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

changelog: Fix `let_and_return` bad suggestion
2020-08-26 12:01:32 +00:00
bors
9ef44799bf Auto merge of #5949 - rail-rain:fix_fp_borrow_interior_mutable_const, r=oli-obk
Fix fp in `borrow_interior_mutable_const`

fixes #5796

changelog: fix false positive in `borrow_interior_mutable_const` when referencing a field behind a pointer.
2020-08-26 11:06:37 +00:00
bors
23db5426e6 Auto merge of #5964 - matsujika:matsujika-patch-1, r=ebroto
Fix typo

changelog: none
2020-08-26 07:53:07 +00:00
Hirochika Matsumoto
9d18c24b56 Fix typo 2020-08-26 16:03:35 +09:00
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
bors
e191151001 Auto merge of #5961 - scottmcm:master, r=Manishearth
Re-enable len_zero for ranges now that `is_empty` is stable on them

Fixes #5956

Completed stabilization PR: https://github.com/rust-lang/rust/pull/75132

changelog: len_zero: re-enable linting ranges now that range_is_empty is stable
2020-08-25 19:30:05 +00: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
f326668577 Auto merge of #5958 - mikerite:fix-fmt-20200825, r=flip1995
Various fmt test improvements

Various fmt test improvements.

changelog: none
2020-08-25 17:15:51 +00: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
bors
ba43a4325c Auto merge of #5947 - ebroto:rustup_doc_improvements, r=flip1995
Improve documentation related to the sync process

[Rendered](https://github.com/ebroto/rust-clippy/blob/rustup_doc_improvements/CONTRIBUTING.md)

r? @flip1995

changelog: none
2020-08-25 16:33:17 +00:00
bors
5ef345a853 Auto merge of #5960 - flip1995:rustup, r=flip1995
Rustup

r? @ghost

changelog: none
2020-08-25 16:11:17 +00:00
Philipp Krones
acc6b6ce07
Fix typo 2020-08-25 18:01:08 +02:00
Bastian
179df0bd15 Added F32::EPSILON and F64::EPSILON to paths.rs 2020-08-25 13:41:39 +02:00
Michael Wright
c7dc9c3cf7 Fix intermittent build error
The fmt test will cause clippy dev to be compiled and run. The clippy dev
dependencies are currently stored at `target/debug/deps` when this happens.
This location sometimes causes conflicts with ui tests which result in the
build error "thread 'compile_test' panicked at 'Found multiple rlibs for crate
`regex` ...".

This commit forces the clippy_dev dependencies to be stored under
`clippy_dev/target/` which seems to resolve this problem.
2020-08-25 05:53:28 +02:00
Michael Wright
48d4736913 Simplify fmt test by using the clippy dev alias 2020-08-25 05:53:28 +02:00
Michael Wright
9102832692 Fix incorrect comment 2020-08-25 05:53:28 +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
Scott McMurray
48b4aeabf8 Unbreak the clippy test 2020-08-24 16:29:03 -07:00
bors
8d9a485ef1 Auto merge of #5935 - matthiaskrgr:unstable_sort_ty_name, r=flip1995
stable_sort_primitive: print the type that is being sorted in the lint message

changelog: stable_sort_primitive: print the type that is being sorted in the lint message
2020-08-24 18:08:39 +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
rail-rain
ce8915c85c
typo
Co-authored-by: Thibaud <ThibsG@users.noreply.github.com>
2020-08-24 19:08:38 +12: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
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