]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRemove method_calls
Yoshitomo Nakanishi [Sat, 13 Mar 2021 06:11:39 +0000 (15:11 +0900)]
Remove method_calls

3 years agoRefactor excessive_for_each
Yoshitomo Nakanishi [Fri, 12 Mar 2021 15:42:43 +0000 (00:42 +0900)]
Refactor excessive_for_each

3 years agoUse ".." as default value of snippet in excessive_for_each
Yoshitomo Nakanishi [Sat, 27 Feb 2021 04:58:41 +0000 (13:58 +0900)]
Use ".." as default value of snippet in excessive_for_each

3 years agoImprove the document of excessive_for_each
Yoshitomo Nakanishi [Sat, 27 Feb 2021 04:50:22 +0000 (13:50 +0900)]
Improve the document of excessive_for_each

3 years agoAdd comments to clarify why RetCollector is needed
Yoshitomo Nakanishi [Tue, 23 Feb 2021 12:55:00 +0000 (21:55 +0900)]
Add comments to clarify why RetCollector is needed

3 years agoRefactor: Remove duplicated codes from excessive_for_each
Yoshitomo Nakanishi [Mon, 22 Feb 2021 12:41:38 +0000 (21:41 +0900)]
Refactor: Remove duplicated codes from excessive_for_each

3 years agoAvoid to suggest using label
Yoshitomo Nakanishi [Thu, 11 Feb 2021 03:50:20 +0000 (12:50 +0900)]
Avoid to suggest using label

3 years agoTrigger the lint iff exposure's body is ExprKind::Block.
Yoshitomo Nakanishi [Tue, 9 Feb 2021 15:53:53 +0000 (00:53 +0900)]
Trigger the lint iff exposure's body is ExprKind::Block.

3 years agoChange a category of excessive_for_each: Style -> Restriction
Yoshitomo Nakanishi [Tue, 9 Feb 2021 14:36:20 +0000 (23:36 +0900)]
Change a category of excessive_for_each: Style -> Restriction

3 years agoFix codes that fails dogfood
Yoshitomo Nakanishi [Tue, 9 Feb 2021 12:20:42 +0000 (21:20 +0900)]
Fix codes that fails dogfood

3 years agoNew Lint: excessive_for_each
Yoshitomo Nakanishi [Mon, 8 Feb 2021 15:24:23 +0000 (00:24 +0900)]
New Lint: excessive_for_each

3 years agoAuto merge of #6981 - matthiaskrgr:6803_take_2, r=flip1995
bors [Wed, 31 Mar 2021 15:02:40 +0000 (15:02 +0000)]
Auto merge of #6981 - matthiaskrgr:6803_take_2, r=flip1995

disable upper_case_acronyms for pub items - enum edition

Fixes https://github.com/rust-lang/rust-clippy/issues/6803 (again... :sweat_smile:  )

My previous fix did not work for enums because enum variants were checked separately in the `check_variant` function but it looks like we can't use that because we can't tell if the enum the variants belong to is declared as public or not (it always said `Inherited` for me)

I went and special-cased enums and iterated over all the variants "manually", but only, if the enums is not public.

---

changelog: fix upper_case_acronyms still firing on public enums (#6803)

3 years agoAuto merge of #6938 - Y-Nak:refactor-types, r=flip1995
bors [Wed, 31 Mar 2021 14:35:48 +0000 (14:35 +0000)]
Auto merge of #6938 - Y-Nak:refactor-types, r=flip1995

Refactor types

r? `@flip1995`
This is the last PR to close #6724 :tada:
Also, this fixes #6936.

changelog: `vec_box`: Fix FN in `const` or `static`
changelog: `linkedlist`: Fix FN in `const` or `static`
changelog: `option_option`: Fix FN in `const` or `static`

3 years agoTrack bound vars
Jack Huey [Tue, 6 Oct 2020 00:41:46 +0000 (20:41 -0400)]
Track bound vars

3 years agolintcheck: warn if checking a program results in bad exit status
Matthias Krüger [Wed, 31 Mar 2021 12:36:56 +0000 (14:36 +0200)]
lintcheck: warn if checking a program results in bad exit status

3 years agoupdate lintcheck logs
Matthias Krüger [Wed, 31 Mar 2021 12:31:26 +0000 (14:31 +0200)]
update lintcheck logs

3 years agoFix hidden variant suggestion on single variant
Michael Wright [Sat, 27 Mar 2021 06:50:19 +0000 (08:50 +0200)]
Fix hidden variant suggestion on single variant

Fixes #6984

3 years agoAuto merge of #7007 - Y-Nak:result_unit_err, r=giraffate
bors [Wed, 31 Mar 2021 04:01:15 +0000 (04:01 +0000)]
Auto merge of #7007 - Y-Nak:result_unit_err, r=giraffate

result_unit_err: Fix typo

changelog: result_unit_err: fix typo in a diagnostic message

r? `@giraffate`
fixes https://github.com/rust-lang/rust-clippy/pull/6990#discussion_r603292920.

3 years agoresult_unit_err: Fix typo
Yoshitomo Nakanishi [Wed, 31 Mar 2021 02:18:48 +0000 (11:18 +0900)]
result_unit_err: Fix typo

3 years agoAuto merge of #7001 - ebobrow:non-octal-file-permissions, r=Manishearth
bors [Tue, 30 Mar 2021 23:23:50 +0000 (23:23 +0000)]
Auto merge of #7001 - ebobrow:non-octal-file-permissions, r=Manishearth

Add non_octal_unix_permissions lint

fixes #6934

changelog: add new lint that checks for non-octal values used to set unix file permissions

3 years agoAdd non_octal_unix_permissions lint
Elliot Bobrow [Mon, 29 Mar 2021 18:18:59 +0000 (11:18 -0700)]
Add non_octal_unix_permissions lint

3 years agoRemove hir::CrateItem.
Camille GILLOT [Tue, 30 Mar 2021 18:31:06 +0000 (20:31 +0200)]
Remove hir::CrateItem.

3 years agoDon't lint `manual_map` in const functions
Jason Newcomb [Fri, 26 Mar 2021 02:48:27 +0000 (22:48 -0400)]
Don't lint `manual_map` in const functions

3 years agoAuto merge of #7004 - Jarcho:manual_map_if_then_else, r=camsteffen
bors [Tue, 30 Mar 2021 14:03:54 +0000 (14:03 +0000)]
Auto merge of #7004 - Jarcho:manual_map_if_then_else, r=camsteffen

Fix `manual_map` at the end of an if chain

changelog: Fix `manual_map` suggestion at the end of an if chain

3 years agoFix `manual_map` at the end of an if chain
Jason Newcomb [Tue, 30 Mar 2021 00:39:28 +0000 (20:39 -0400)]
Fix `manual_map` at the end of an if chain

3 years agowrong_self_convention: fix FP inside trait impl for `to_*` method
Mateusz Gacek [Mon, 29 Mar 2021 19:51:23 +0000 (12:51 -0700)]
wrong_self_convention: fix FP inside trait impl for `to_*` method

When the `to_*` method takes `&self` and it is a trait implementation,
we don't trigger the lint.

3 years agoAuto merge of #7000 - Jarcho:clone_on_copy_fp, r=llogiq
bors [Tue, 30 Mar 2021 05:25:28 +0000 (05:25 +0000)]
Auto merge of #7000 - Jarcho:clone_on_copy_fp, r=llogiq

Improve `clone_on_copy`

This also removes the `clone_on_copy_mut` test as the same thing is covered in the `clone_on_copy` test.

changelog: `copy_on_clone` lint on chained method calls taking self by value
changelog: `copy_on_clone` only lint when using the `Clone` trait
changelog: `copy_on_clone` correct suggestion when the cloned value is a macro call.

3 years agoAuto merge of #6990 - Y-Nak:refactor-functions, r=giraffate
bors [Tue, 30 Mar 2021 03:59:45 +0000 (03:59 +0000)]
Auto merge of #6990 - Y-Nak:refactor-functions, r=giraffate

Organize functions into functions module

Ref: #6680
Rearrange lints in `functions`.

changelog: none

3 years agoImprove documents in functions group
Yoshitomo Nakanishi [Tue, 30 Mar 2021 02:45:54 +0000 (11:45 +0900)]
Improve documents in functions group

3 years agoAuto merge of #7003 - giraffate:use_uppercase_for_msrv, r=camsteffen
bors [Tue, 30 Mar 2021 00:55:42 +0000 (00:55 +0000)]
Auto merge of #7003 - giraffate:use_uppercase_for_msrv, r=camsteffen

Use uppercase for MSRV

A follow-up of <https://github.com/rust-lang/rust-clippy/pull/6977/files#diff-dac623e7b9c58138761aa527bf5f026bf113cda5b22eea61e655b44dd113389e>

changelog: none

3 years agoUse uppercase for MSRV
Takayuki Nakata [Mon, 29 Mar 2021 23:42:59 +0000 (08:42 +0900)]
Use uppercase for MSRV

3 years agoImprove `clone_on_copy`
Jason Newcomb [Mon, 29 Mar 2021 17:29:58 +0000 (13:29 -0400)]
Improve `clone_on_copy`
Lint on `_.clone().method()` when method takes self by value
Set applicability correctly
Correct suggestion when the cloned value is a macro call. e.g. `m!(x).clone()`
Don't lint when not using the `Clone` trait

3 years agoAuto merge of #6996 - Y-Nak:missing_panics_doc, r=Manishearth
bors [Mon, 29 Mar 2021 15:04:27 +0000 (15:04 +0000)]
Auto merge of #6996 - Y-Nak:missing_panics_doc, r=Manishearth

Allow missing panics doc if the panics occur only when debug-assertions is specified

fixes #6970

changelog: `missing_panics_doc`: Allow missing panics doc if the panics occur only when `debug-assertions` is specified.

3 years agomissing_panics_doc: Ignore usage of debug_assert family
Yoshitomo Nakanishi [Mon, 29 Mar 2021 08:19:05 +0000 (17:19 +0900)]
missing_panics_doc: Ignore usage of debug_assert family

3 years agoFix inconsistent test name
Yoshitomo Nakanishi [Mon, 29 Mar 2021 07:19:52 +0000 (16:19 +0900)]
Fix inconsistent test name

3 years agoAuto merge of #6993 - Jarcho:expl_impl_clone, r=llogiq
bors [Sun, 28 Mar 2021 23:30:56 +0000 (23:30 +0000)]
Auto merge of #6993 - Jarcho:expl_impl_clone, r=llogiq

Improve `expl_impl_clone_on_copy`

fixes: #1254

changelog: Check to see if the generic constraints are the same as if using derive for `expl_impl_clone_on_copy`

3 years agoAuto merge of #6991 - matthiaskrgr:5396, r=giraffate
bors [Sun, 28 Mar 2021 14:20:53 +0000 (14:20 +0000)]
Auto merge of #6991 - matthiaskrgr:5396, r=giraffate

redundant_pattern_matching: look inside Refs

look inside refs and detect if let &None = ...

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

changelog:  redundant_pattern_matching: look inside Refs to fix FNs with "if let &None = .. "

3 years agoImprove `expl_impl_clone_on_copy`
Jason Newcomb [Sun, 28 Mar 2021 01:48:10 +0000 (21:48 -0400)]
Improve `expl_impl_clone_on_copy`
Check to see if the generic constraints are the same as if using derive

3 years agoTake into account sub modules
ThibsG [Sun, 28 Mar 2021 07:35:44 +0000 (09:35 +0200)]
Take into account sub modules

3 years agoFix FP in `single_component_path_imports` lint
ThibsG [Sun, 14 Mar 2021 18:35:35 +0000 (19:35 +0100)]
Fix FP in `single_component_path_imports` lint

3 years agoRemove (lots of) dead code
Joshua Nelson [Tue, 16 Mar 2021 05:50:34 +0000 (01:50 -0400)]
Remove (lots of) dead code

Found with https://github.com/est31/warnalyzer.

Dubious changes:
- Is anyone else using rustc_apfloat? I feel weird completely deleting
  x87 support.
- Maybe some of the dead code in rustc_data_structures, in case someone
  wants to use it in the future?
- Don't change rustc_serialize

  I plan to scrap most of the json module in the near future (see
  https://github.com/rust-lang/compiler-team/issues/418) and fixing the
  tests needed more work than I expected.

TODO: check if any of the comments on the deleted code should be kept.

3 years agoredundant_pattern_matching: look inside Refs
Matthias Krüger [Sat, 27 Mar 2021 23:04:44 +0000 (00:04 +0100)]
redundant_pattern_matching: look inside Refs

look inside refs and detect if let &None = ...

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

changelog:  redundant_pattern_matching: look inside Refs to fix FNs with "if let &None = .. "

3 years agoRollup merge of #82917 - cuviper:iter-zip, r=m-ou-se
Dylan DPC [Sat, 27 Mar 2021 19:37:07 +0000 (20:37 +0100)]
Rollup merge of #82917 - cuviper:iter-zip, r=m-ou-se

Add function core::iter::zip

This makes it a little easier to `zip` iterators:

```rust
for (x, y) in zip(xs, ys) {}
// vs.
for (x, y) in xs.into_iter().zip(ys) {}
```

You can `zip(&mut xs, &ys)` for the conventional `iter_mut()` and
`iter()`, respectively. This can also support arbitrary nesting, where
it's easier to see the item layout than with arbitrary `zip` chains:

```rust
for ((x, y), z) in zip(zip(xs, ys), zs) {}
for (x, (y, z)) in zip(xs, zip(ys, zs)) {}
// vs.
for ((x, y), z) in xs.into_iter().zip(ys).zip(xz) {}
for (x, (y, z)) in xs.into_iter().zip((ys.into_iter().zip(xz)) {}
```

It may also format more nicely, especially when the first iterator is a
longer chain of methods -- for example:

```rust
    iter::zip(
        trait_ref.substs.types().skip(1),
        impl_trait_ref.substs.types().skip(1),
    )
    // vs.
    trait_ref
        .substs
        .types()
        .skip(1)
        .zip(impl_trait_ref.substs.types().skip(1))
```

This replaces the tuple-pair `IntoIterator` in #78204.
There is prior art for the utility of this in [`itertools::zip`].

[`itertools::zip`]: https://docs.rs/itertools/0.10.0/itertools/fn.zip.html

3 years agoMove result_unit_err to its own module
Yoshitomo Nakanishi [Sat, 27 Mar 2021 13:48:25 +0000 (22:48 +0900)]
Move result_unit_err to its own module

3 years agoMove lints related to must_use to their own module
Yoshitomo Nakanishi [Sat, 27 Mar 2021 13:41:55 +0000 (22:41 +0900)]
Move lints related to must_use to their own module

3 years agomove not_unsafe_ptr_arg_deref to its own module
Yoshitomo Nakanishi [Sat, 27 Mar 2021 11:43:59 +0000 (20:43 +0900)]
move not_unsafe_ptr_arg_deref to its own module

3 years agoMove too_many_lines to its own module
Yoshitomo Nakanishi [Wed, 24 Mar 2021 14:20:31 +0000 (23:20 +0900)]
Move too_many_lines to its own module

3 years agoMove too_many_arguments to its own module
Yoshitomo Nakanishi [Wed, 24 Mar 2021 14:12:08 +0000 (23:12 +0900)]
Move too_many_arguments to its own module

3 years agoAuto merge of #6979 - flip1995:msrv_doc_fix, r=giraffate
bors [Sat, 27 Mar 2021 13:27:51 +0000 (13:27 +0000)]
Auto merge of #6979 - flip1995:msrv_doc_fix, r=giraffate

Add missing lints to MSRV config doc

r? `@giraffate`

changelog: Add missing lints to MSRV config doc

3 years agoAuto merge of #6980 - Jarcho:len_without_is_empty_sig, r=llogiq
bors [Sat, 27 Mar 2021 13:10:43 +0000 (13:10 +0000)]
Auto merge of #6980 - Jarcho:len_without_is_empty_sig, r=llogiq

`len_without_is_empty` improvements

fixes: #6958
fixes: #6972

changelog: Check the return type of `len`. Only integral types, or an `Option` or `Result` wrapping one.
changelog: Ensure the return type of `is_empty` matches. e.g. `Option<usize>` -> `Option<bool>`

3 years ago`len_without_is_empty` improvements
Jason Newcomb [Fri, 26 Mar 2021 20:27:19 +0000 (16:27 -0400)]
`len_without_is_empty` improvements
Check the return type of `len`. Only integral types, or an `Option` or `Result` wrapping one.
Ensure the return type of `is_empty` matches. e.g. `Option<usize>` -> `Option<bool>`

3 years agoformat macro argument parsing fix
Ömer Sinan Ağacan [Sun, 21 Mar 2021 14:29:21 +0000 (17:29 +0300)]
format macro argument parsing fix

When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes #83344

3 years agoupper_case_acronyms: add ui and ui-toml tests for private/public enums
Matthias Krüger [Fri, 26 Mar 2021 23:52:49 +0000 (00:52 +0100)]
upper_case_acronyms: add ui and ui-toml tests for private/public enums

3 years agoupper_case_acronyms: only lint enum variants if the enum is not public
Matthias Krüger [Fri, 26 Mar 2021 23:44:30 +0000 (00:44 +0100)]
upper_case_acronyms: only lint enum variants if the enum is not public

3 years agoUse iter::zip in src/tools/clippy/
Josh Stone [Mon, 8 Mar 2021 23:57:44 +0000 (15:57 -0800)]
Use iter::zip in src/tools/clippy/

3 years agoAdd missing lints to MSRV config doc
flip1995 [Fri, 26 Mar 2021 14:39:23 +0000 (15:39 +0100)]
Add missing lints to MSRV config doc

3 years agoAuto merge of #6977 - flip1995:or_patterns_msrv, r=llogiq
bors [Fri, 26 Mar 2021 15:12:50 +0000 (15:12 +0000)]
Auto merge of #6977 - flip1995:or_patterns_msrv, r=llogiq

Add MSRV options to `unnested_or_patterns`

changelog: [`unnested_or_patterns`] can now be configured with the `msrv` config/attribute.

Fixes #6953

3 years agoFix trailing whitespaces in doc/adding_lints.md
flip1995 [Fri, 26 Mar 2021 09:58:37 +0000 (10:58 +0100)]
Fix trailing whitespaces in doc/adding_lints.md

3 years agoImprove doc on how to add MSRV to a lint
flip1995 [Fri, 26 Mar 2021 09:57:51 +0000 (10:57 +0100)]
Improve doc on how to add MSRV to a lint

3 years agoAdd MSRV option to unnested_or_patterns lint
flip1995 [Fri, 26 Mar 2021 09:56:05 +0000 (10:56 +0100)]
Add MSRV option to unnested_or_patterns lint

3 years agoMerge type_complexity pass into types pass
Yoshitomo Nakanishi [Sat, 20 Mar 2021 06:32:19 +0000 (15:32 +0900)]
Merge type_complexity pass into types pass

3 years agoFix inconsistent test names
Yoshitomo Nakanishi [Fri, 19 Mar 2021 09:21:33 +0000 (18:21 +0900)]
Fix inconsistent test names

3 years agoFix FN that types lints don't work with const or static
Yoshitomo Nakanishi [Fri, 19 Mar 2021 09:14:48 +0000 (18:14 +0900)]
Fix FN that types lints don't work with const or static

3 years agoMove implicit_hasher to its own module
Yoshitomo Nakanishi [Thu, 18 Mar 2021 07:34:22 +0000 (16:34 +0900)]
Move implicit_hasher to its own module

3 years agoMove invalid_upcast_comparisons to its own module
Yoshitomo Nakanishi [Thu, 18 Mar 2021 07:15:19 +0000 (16:15 +0900)]
Move invalid_upcast_comparisons to its own module

3 years agoMove absurd_extreme_comparisons to its own module
Yoshitomo Nakanishi [Thu, 18 Mar 2021 07:03:56 +0000 (16:03 +0900)]
Move absurd_extreme_comparisons to its own module

3 years agoAuto merge of #6975 - Jarcho:redundant_slicing_fp, r=llogiq
bors [Fri, 26 Mar 2021 10:01:26 +0000 (10:01 +0000)]
Auto merge of #6975 - Jarcho:redundant_slicing_fp, r=llogiq

Improve `redundant_slicing`

fixes: #6968

changelog: Fix `redundant_slicing` suggestion when a reborrow might be required or when the value is from a macro call

3 years agoImprove `redundant_slicing`
Jason Newcomb [Fri, 26 Mar 2021 02:30:14 +0000 (22:30 -0400)]
Improve `redundant_slicing`
Fix bad suggestion when a reborrow might be required
Fix bad suggestion when the value being sliced is a macro call
Don't lint inside of a macro due to the previous context sensitive changes

3 years agoAuto merge of #6961 - xFrednet:changelog-1-52, r=flip1995
bors [Thu, 25 Mar 2021 18:39:19 +0000 (18:39 +0000)]
Auto merge of #6961 - xFrednet:changelog-1-52, r=flip1995

Update changelog for 1.52

I've underestimated the work that goes into this a bit, but it just shows that a lot has happened again in Clippy in 1.52 :upside_down_face:.

[Rendered](https://github.com/xFrednet/rust-clippy/blob/changelog-1-52/CHANGELOG.md)

---

changelog: none

3 years agoUpdated changelog for 1.52
xFrednet [Wed, 24 Mar 2021 00:05:19 +0000 (01:05 +0100)]
Updated changelog for 1.52

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
3 years agoMerge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyup
flip1995 [Thu, 25 Mar 2021 18:29:11 +0000 (19:29 +0100)]
Merge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyup

3 years agoAuto merge of #6971 - flip1995:rustup, r=flip1995
bors [Thu, 25 Mar 2021 17:49:06 +0000 (17:49 +0000)]
Auto merge of #6971 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoBump Clippy Version -> 0.1.53
flip1995 [Thu, 25 Mar 2021 17:48:48 +0000 (18:48 +0100)]
Bump Clippy Version -> 0.1.53

3 years agoBump nightly version -> 2021-03-25
flip1995 [Thu, 25 Mar 2021 17:38:52 +0000 (18:38 +0100)]
Bump nightly version -> 2021-03-25

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 25 Mar 2021 17:38:13 +0000 (18:38 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAuto merge of #6959 - ebobrow:iss-6927-fix, r=camsteffen
bors [Thu, 25 Mar 2021 03:01:35 +0000 (03:01 +0000)]
Auto merge of #6959 - ebobrow:iss-6927-fix, r=camsteffen

Check for `.to_string().into_bytes()` in string_lit_to_bytes

fixes #6927

changelog: Add a check for `into_bytes()` to string_lit_to_bytes lint

3 years agocheck for `.to_string().into_bytes()` in string_lit_to_bytes
Elliot Bobrow [Wed, 24 Mar 2021 00:10:27 +0000 (17:10 -0700)]
check for `.to_string().into_bytes()` in string_lit_to_bytes

apply changes from review

3 years agoAuto merge of #6952 - Jarcho:new_ret_no_self_fp, r=Manishearth
bors [Wed, 24 Mar 2021 21:09:01 +0000 (21:09 +0000)]
Auto merge of #6952 - Jarcho:new_ret_no_self_fp, r=Manishearth

Fix `new_ret_no_self` false positive

fixes: #1724

changelog: Fix false positive with `new_ret_no_self` when returning `Self` with different generic arguments

3 years agoRename `contains_adt` to `contains_adt_constructor`
Jason Newcomb [Wed, 24 Mar 2021 20:19:27 +0000 (16:19 -0400)]
Rename `contains_adt` to `contains_adt_constructor`

3 years agoFix false positive with `new_ret_no_self` when returning `Self` with different generi...
Jason Newcomb [Tue, 23 Mar 2021 01:38:14 +0000 (21:38 -0400)]
Fix false positive with `new_ret_no_self` when returning `Self` with different generic arguments

3 years agoAuto merge of #6962 - TaKO8Ki:fix-false-positive-in-manual-flatten, r=llogiq
bors [Wed, 24 Mar 2021 18:42:20 +0000 (18:42 +0000)]
Auto merge of #6962 - TaKO8Ki:fix-false-positive-in-manual-flatten, r=llogiq

Fix false positive in `manual_flatten`

This pull request fixes false positive in `manual_flatten` in case using a slice of references .

closes: #6893

changelog: fix false positive in `manual_flatten`

3 years agomerge imports
Takayuki Maeda [Wed, 24 Mar 2021 15:17:43 +0000 (00:17 +0900)]
merge imports

3 years agofix false positive in manual_flatten
Takayuki Maeda [Wed, 24 Mar 2021 15:15:15 +0000 (00:15 +0900)]
fix false positive in manual_flatten

3 years agoAdd has_default to GenericParamDefKind::Const
kadmin [Tue, 11 Aug 2020 00:02:45 +0000 (00:02 +0000)]
Add has_default to GenericParamDefKind::Const

This currently creates a field which is always false on GenericParamDefKind for future use when
consts are permitted to have defaults

Update const_generics:default locations

Previously just ignored them, now actually do something about them.

Fix using type check instead of value

Add parsing

This adds all the necessary changes to lower const-generics defaults from parsing.

Change P<Expr> to AnonConst

This matches the arguments passed to instantiations of const generics, and makes it specific to
just anonymous constants.

Attempt to fix lowering bugs

3 years agoAuto merge of #6957 - camsteffen:eq-ty-kind, r=flip1995
bors [Tue, 23 Mar 2021 16:25:28 +0000 (16:25 +0000)]
Auto merge of #6957 - camsteffen:eq-ty-kind, r=flip1995

Factor out `SpanlessEq::eq_ty_kind`

changelog: none

3 years agoFactor out eq_ty_kind
Cameron Steffen [Tue, 23 Mar 2021 15:40:27 +0000 (10:40 -0500)]
Factor out eq_ty_kind

3 years agoAuto merge of #6950 - Sciencentistguy:master, r=phansch
bors [Mon, 22 Mar 2021 20:29:13 +0000 (20:29 +0000)]
Auto merge of #6950 - Sciencentistguy:master, r=phansch

Ignore str::len() in or_fun_call lint.

changelog: Changed `or_fun_call` to ignore `str::len`, in the same way it ignores `slice::len` and `array::len`

Closes #6943

3 years agoAuto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakis
bors [Mon, 22 Mar 2021 19:48:27 +0000 (19:48 +0000)]
Auto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakis

Stabilize or_patterns (RFC 2535, 2530, 2175)

closes #54883

This PR stabilizes the or_patterns feature in Rust 1.53.

This is blocked on the following (in order):
- [x] The crater run in https://github.com/rust-lang/rust/pull/78935#issuecomment-731564021
- [x] The resolution of the unresolved questions and a second crater run (https://github.com/rust-lang/rust/pull/78935#issuecomment-735412705)
    - It looks like we will need to pursue some sort of edition-based transition for `:pat`.
- [x] Nomination and discussion by T-lang
- [x] Implement new behavior for `:pat` based on consensus (https://github.com/rust-lang/rust/pull/80100).
- [ ] An FCP on stabilization

EDIT: Stabilization report is in https://github.com/rust-lang/rust/pull/79278#issuecomment-772815177

3 years agoAuto merge of #6896 - TaKO8Ki:refactor-lints-in-methods-module, r=phansch
bors [Mon, 22 Mar 2021 19:36:22 +0000 (19:36 +0000)]
Auto merge of #6896 - TaKO8Ki:refactor-lints-in-methods-module, r=phansch

Refactor lints in methods module

This PR refactors methods lints other than the lints I refactored in https://github.com/rust-lang/rust-clippy/pull/6826 and moves some functions to methods/utils.rs.
Basically, I follow the instruction described in #6680.

**For ease of review, I refactored step by step, keeping each commit small.**

closes https://github.com/rust-lang/rust-clippy/issues/6886
cc: `@phansch,` `@flip1995,` `@Y-Nak`

changelog: Move lints in methods module to their own modules and some function to methods/utils.rs.

3 years agoIgnore str::len() in or_fun_call lint.
Jamie Quigley [Mon, 22 Mar 2021 19:34:20 +0000 (19:34 +0000)]
Ignore str::len() in or_fun_call lint.

3 years agoAuto merge of #6942 - mgacek8:issue_6815_search_is_none, r=llogiq
bors [Mon, 22 Mar 2021 12:58:47 +0000 (12:58 +0000)]
Auto merge of #6942 - mgacek8:issue_6815_search_is_none, r=llogiq

search_is_some: add checking for `is_none()`

fixes: #6815
changelog: search_is_some: add checking for `is_none()`.

To be honest I don't know what is the process of renaming the lints. Appreciate any feedback if that needs to be handled differently. Thanks!

3 years agosearch_is_some: check also when search is none
Mateusz Gacek [Sat, 20 Mar 2021 13:30:45 +0000 (14:30 +0100)]
search_is_some: check also when search is none

3 years agoAuto merge of #6945 - ThibsG:BadSuggestionGenericsForReassignDefault, r=Manishearth
bors [Sun, 21 Mar 2021 14:42:45 +0000 (14:42 +0000)]
Auto merge of #6945 - ThibsG:BadSuggestionGenericsForReassignDefault, r=Manishearth

Fix suggestion with generics for `field_reassign_with_default` lint

Fix bad suggestion where `::` is missing after type if generics are involved

Fixes #6944

changelog: none

3 years agoFix suggestion with generics for `field_reassign_with_default` lint
ThibsG [Sun, 21 Mar 2021 08:50:35 +0000 (09:50 +0100)]
Fix suggestion with generics for `field_reassign_with_default` lint

3 years agoAuto merge of #6941 - ThibsG:suggMatchSingleBinding, r=llogiq
bors [Sat, 20 Mar 2021 17:35:21 +0000 (17:35 +0000)]
Auto merge of #6941 - ThibsG:suggMatchSingleBinding, r=llogiq

Fix bad suggestion for `match_single_binding` lint

Fix a bad suggestion that needs curly braces when the target `match` is the body of an arm.

Fixes #6572

changelog: none

3 years agoAuto merge of #6939 - ThibsG:suggNewWithoutDefault, r=llogiq
bors [Sat, 20 Mar 2021 17:20:34 +0000 (17:20 +0000)]
Auto merge of #6939 - ThibsG:suggNewWithoutDefault, r=llogiq

Fix bad suggestion for generics in `new_without_default` lint

Fixes bad suggestion where a type parameter was missing for `new_without_default` lint.

Fixes #6933

changelog: none

3 years agoupdate `const_eval_resolve`
lcnr [Sat, 13 Mar 2021 15:31:38 +0000 (16:31 +0100)]
update `const_eval_resolve`

3 years agoSplit `match_single_binding` tests in 2 files (too many lines for CI)
ThibsG [Sat, 20 Mar 2021 15:31:39 +0000 (16:31 +0100)]
Split `match_single_binding` tests in 2 files (too many lines for CI)

3 years agoFix bad suggestion that needs curly braces for `match_single_binding` lint
ThibsG [Sat, 20 Mar 2021 15:11:19 +0000 (16:11 +0100)]
Fix bad suggestion that needs curly braces for `match_single_binding` lint

3 years agoFix bad suggestion for generics in `new_without_default` lint
ThibsG [Sat, 20 Mar 2021 09:24:10 +0000 (10:24 +0100)]
Fix bad suggestion for generics in `new_without_default` lint