Philipp Krones
4ee55c5528
Merge remote-tracking branch 'upstream/auto' into rustup
2022-09-08 21:27:09 +02:00
bors
567e1bbca7
Auto merge of #101432 - nnethercote:shrink-PredicateS, r=lcnr
...
Shrink `PredicateS`
r? `@ghost`
2022-09-07 13:49:58 +00:00
Takayuki Maeda
097ef517fe
refactor: remove unnecessary variables
2022-09-05 22:31:02 +09:00
Takayuki Maeda
4bcaddeeb2
separate the receiver from arguments in HIR under /clippy
2022-09-05 22:25:57 +09:00
Nicholas Nethercote
2d4349c22d
Pack Term
in the same way as GenericArg
.
...
This shrinks the `PredicateS` type, which is instanted frequently.
2022-09-05 15:08:52 +10:00
relrelb
f0e586c251
Suggest Entry::or_default
for Entry::or_insert(Default::default())
...
Unlike past similar work done in #6228 , expand the existing `or_fun_call`
lint to detect `or_insert` calls with a `T::new()` or `T::default()`
argument, much like currently done for `unwrap_or` calls. In that case,
suggest the use of `or_default`, which is more idiomatic.
Note that even with this change, `or_insert_with(T::default)` calls
aren't detected as candidates for `or_default()`, in the same manner
that currently `unwrap_or_else(T::default)` calls aren't detected as
candidates for `unwrap_or_default()`.
Also, as a nearby cleanup, change `KNOW_TYPES` from `static` to `const`,
since as far as I understand it's preferred (should Clippy have a lint
for that?).
Fixes #3812 .
2022-09-04 23:43:17 +03:00
Jason Newcomb
fb41bfa774
Merge commit 'f51aade56f93175dde89177a92e3669ebd8e7592' into clippyup
2022-08-31 09:24:45 -04:00
Marco Mastropaolo
de028e2fb9
Implemented suspicious_to_owned lint to check if to_owned
is called on a Cow
.
...
This is done because `to_owned` is very similarly named to `into_owned`, but the
effect of calling those two methods is completely different. This creates
confusion (stemming from the ambiguity of the 'owned' term in the context of
`Cow`s) and might not be what the writer intended.
2022-08-26 17:41:17 -07:00
Michael Wright
a0afbdfbec
Replace contains_ty(..)
with Ty::contains(..)
...
This removes some code we don't need and the method syntax is
also more readable IMO.
2022-08-24 08:11:29 +02:00
Nahua Kang
b070b4045f
Simplify lint logic and address code review comments
2022-08-20 12:09:09 +02:00
Nahua Kang
fb30b64f63
Adjust test cases; run cargo dev bless
2022-08-19 20:00:20 +02:00
Nahua Kang
a9bd0bd321
Handle repeated str::replace calls with single char kind to str
2022-08-19 20:00:19 +02:00
Nahua Kang
6e86687529
Handle replace calls with char slices
2022-08-19 19:55:28 +02:00
Nahua Kang
a4413f75bf
Register new lint collapsible_str_replace to methods
2022-08-19 19:49:15 +02:00
Jason Newcomb
d8808db006
Move VerboseFileReads
into Methods
lint pass
2022-08-19 10:54:55 -04:00
Jason Newcomb
8acc4d2f1e
Move VecResizeToZero
into Methods
lint pass
2022-08-19 10:54:55 -04:00
Jason Newcomb
d8d4a135ea
Move UnnecessarySortBy
into Methods
lint pass
2022-08-19 10:54:55 -04:00
Jason Newcomb
bb0584dfb4
Move UnitHash
into Methods
lint pass
2022-08-19 10:54:55 -04:00
Jason Newcomb
e834855950
Move StableSortPrimitive
to Methods
lint pass
2022-08-19 10:54:55 -04:00
Jason Newcomb
06d752e28d
Move RepeatOnce
into Methods
lint pass
2022-08-19 10:54:55 -04:00
Jason Newcomb
fd5376194a
Move range_zip_with_len
into Methods
lint pass
2022-08-19 10:54:55 -04:00
Jason Newcomb
226f135a03
Move PathBufPushOverwrite
into Methods
lint group
2022-08-19 10:32:31 -04:00
Jason Newcomb
0cc01cef30
Move OpenOptions
into Methods
lint pass
2022-08-19 10:32:16 -04:00
Jason Newcomb
508cf6bdbc
Move MutMutexLock
into Methods
lint pass
2022-08-19 10:32:16 -04:00
Jason Newcomb
2f0ed0a0b1
Move MapErrIgnore
into Methods
lint pass
2022-08-19 10:32:15 -04:00
Jason Newcomb
452395485b
Move MapClone
into Methods
lint pass
2022-08-19 10:31:41 -04:00
Jason Newcomb
5bc8813cdd
Move ManualOkOr
into Methods
lint pass
2022-08-19 10:31:41 -04:00
Jason Newcomb
a8d80d531f
Move GetFirst
into Methods
lint pass
2022-08-19 10:29:55 -04:00
Jason Newcomb
e3b77974d0
Move CaseSensitiveFileExtensionComparisons
into Methods
lint pass
2022-08-19 10:29:55 -04:00
Jason Newcomb
ba6a459528
Move BytesCountToLen
into Methods
lint pass
2022-08-19 10:28:59 -04:00
Jason Newcomb
2502898686
Move ByteCount
into Methods
lint pass
2022-08-19 10:28:59 -04:00
Sosthène Guédon
c1e04352bd
unwrap_used and expect_used: trigger on uses of their _err variants
2022-08-16 18:31:57 +02:00
bors
679fa9f2bf
Auto merge of #9187 - sgued:iter-once, r=flip1995
...
Add lint recommending using `std::iter::once` and `std::iter::empty`
```
changelog: [`iter_once`]: add new lint
changelog: [`iter_empty`]: add new lint
```
fixes #9186
- \[ ] Followed [lint naming conventions][lint_naming]
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints`
- \[x] Added lint documentation
- \[x] Run `cargo dev fmt`
[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
The lint doesn't really follow the naming conventions. I don't have any better idea so I'm open to suggestions.
2022-08-14 15:45:17 +00:00
flip1995
f18cd274be
Update lint versions for 1.63 release
2022-08-12 23:19:53 +02:00
Philipp Krones
dc29cfb8d5
Merge commit '2b2190cb5667cdd276a24ef8b9f3692209c54a89' into clippyup
2022-08-11 19:42:16 +02:00
Sosthène Guédon
af4885c0cd
Rename new lints to iter_on_empty_collections and iter_on_single_items
2022-08-08 21:05:27 +02:00
Sosthène Guédon
f30d7c2495
Improve suggestions
2022-08-08 21:04:44 +02:00
Sosthène Guédon
f3f86d8fd9
Move iter_once and iter_empty to methods as a late pass
...
This enables more thorough checking of types to avoid triggering on
custom Some and None enum variants
2022-08-08 21:04:44 +02:00
Sosthene
23b4fe6da5
Apply suggestions from code review
...
The expect_used lint is allow-by-default, so it would be better to show the case where this is enabled.
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2022-07-30 13:17:51 +02:00
Sosthène Guédon
1fd9f2d271
Fix tests
2022-07-28 22:27:57 +02:00
Sosthène Guédon
307b800f27
unwrap_used: Fix doc to not recommend expect when expect_used is not allowed
2022-07-28 22:08:48 +02:00
Philipp Krones
67c405cc1d
Merge commit '3c7e7dbc1583a0b06df5bd7623dd354a4debd23d' into clippyup
2022-07-28 19:08:22 +02:00
bors
cce617165d
Auto merge of #9148 - arieluy:then_some_unwrap_or, r=Jarcho
...
Add new lint `obfuscated_if_else`
part of #9100 , additional commits could make it work with `then` and `unwrap_or_else` as well
changelog: Add new lint `obfuscated_if_else`
2022-07-18 12:45:11 +00:00
Philipp Krones
7d4daaa8fa
Merge commit 'fdb84cbfd25908df5683f8f62388f663d9260e39' into clippyup
2022-07-18 09:39:37 +02:00
Ariel Uy
9ff7c91100
Add new lint obfuscated_if_else
...
New lint suggests using `if .. else ..` instead of
`.then_some(..).unwrap_or(..)`.
2022-07-17 18:44:49 -07:00
bors
3a4e4575ed
Auto merge of #9022 - alex-semenyuk:needless_option_take_more_docs, r=Jarcho
...
`NEEDLESS_OPTION_TAKE` doc improvements
changelog: More info on `NEEDLESS_OPTION_TAKE`
2022-07-17 13:33:40 +00:00
alexey semenyuk
e7804355de
NEEDLESS_OPTION_TAKE doc improvements
...
NEEDLESS_OPTION_TAKE doc improvements
NEEDLESS_OPTION_TAKE doc improvements
NEEDLESS_OPTION_TAKE doc improvements
NEEDLESS_OPTION_TAKE doc improvements
NEEDLESS_OPTION_TAKE doc improvements
NEEDLESS_OPTION_TAKE doc improvements
NEEDLESS_OPTION_TAKE doc improvements
2022-07-17 16:13:58 +03:00
bors
f93d418f17
Auto merge of #9099 - joshtriplett:unnecessary-lazy-eval-then-some, r=flip1995
...
Extend unnecessary_lazy_eval to cover `bool::then` -> `bool::then_some`
fixes #9097
changelog: Extend `unnecessary_lazy_eval` to convert `bool::then` to `bool::then_some`
2022-07-06 09:20:55 +00:00
Josh Triplett
ebff7206bc
Add MSRV check for bool::then_some
2022-07-06 01:00:19 -07:00
Josh Triplett
528308b5aa
Extend unnecessary_lazy_eval to cover bool::then
-> bool::then_some
2022-07-06 00:48:51 -07:00