]> git.lizzy.rs Git - rust.git/log
rust.git
19 months agoAuto merge of #10007 - Jarcho:issue_10005, r=giraffate
bors [Thu, 1 Dec 2022 07:20:06 +0000 (07:20 +0000)]
Auto merge of #10007 - Jarcho:issue_10005, r=giraffate

Fix ICE in `result_large_err` with uninhabited enums

fixes #10005
changelog: `result_large_err`: Fix ICE with uninhabited enums

19 months agoFix ICE in `result large_err` with uninhabited enums
Jason Newcomb [Thu, 1 Dec 2022 02:44:18 +0000 (21:44 -0500)]
Fix ICE in `result large_err` with uninhabited enums

19 months agoAuto merge of #9943 - dswij:pr-9940, r=Jarcho
bors [Wed, 30 Nov 2022 21:23:10 +0000 (21:23 +0000)]
Auto merge of #9943 - dswij:pr-9940, r=Jarcho

manual_let_else: keep macro call on suggestion blocks

Closes #9940

changelog: [`manual_let_else`]: Do not expand macro calls on suggestions

19 months agoAuto merge of #10001 - Jarcho:issue_9866, r=llogiq
bors [Wed, 30 Nov 2022 19:54:25 +0000 (19:54 +0000)]
Auto merge of #10001 - Jarcho:issue_9866, r=llogiq

Fix ICE in `unused_rounding`

fixes #9866
changelog: `unused_rounding`: Fix ICE when using the `_` separator

19 months agoAuto merge of #9996 - Jarcho:issue_9906, r=Alexendoo
bors [Wed, 30 Nov 2022 19:40:22 +0000 (19:40 +0000)]
Auto merge of #9996 - Jarcho:issue_9906, r=Alexendoo

Fix `unnecessary_cast` suggestion when taking a reference

fixes #9906
changelog: `unnecessary_cast`: Fix suggestion when taking a reference

19 months agoAuto merge of #9997 - Jarcho:issue_9901, r=llogiq
bors [Wed, 30 Nov 2022 19:29:40 +0000 (19:29 +0000)]
Auto merge of #9997 - Jarcho:issue_9901, r=llogiq

Don't lint `explicit_auto_deref` when the initial type is neither a reference, nor a receiver

fixes #9901
fixes #9777
changelog: `explicit_auto_deref`: Don't lint when the initial value is neither a reference, nor a receiver

19 months agoFix ICE in `unused_rounding`
Jason Newcomb [Wed, 30 Nov 2022 17:31:38 +0000 (12:31 -0500)]
Fix ICE in `unused_rounding`

19 months agoAuto merge of #9987 - Jarcho:issue_9957, r=flip1995
bors [Wed, 30 Nov 2022 16:31:56 +0000 (16:31 +0000)]
Auto merge of #9987 - Jarcho:issue_9957, r=flip1995

Don't cross contexts while building the suggestion for `redundant_closure_call`

fixes #9957

changelog: `redundant_closure_call`: Don't cross macro contexts while building the suggestion

19 months agoDon't lint `explicit_auto_deref` when the initial type is neither a reference, nor...
Jason Newcomb [Wed, 30 Nov 2022 16:15:49 +0000 (11:15 -0500)]
Don't lint `explicit_auto_deref` when the initial type is neither a reference, nor a receiver

19 months agoFix `unnecessary_cast` suggestion when taking a reference
Jason Newcomb [Wed, 30 Nov 2022 15:48:53 +0000 (10:48 -0500)]
Fix `unnecessary_cast` suggestion when taking a reference

19 months agoDon't cross contexts while building the suggestion for `redundant_closure_call`
Jason Newcomb [Tue, 29 Nov 2022 15:36:43 +0000 (10:36 -0500)]
Don't cross contexts while building the suggestion for `redundant_closure_call`

19 months agoAuto merge of #9989 - xFrednet:9986-move-safety-thingy, r=flip1995
bors [Wed, 30 Nov 2022 12:44:45 +0000 (12:44 +0000)]
Auto merge of #9989 - xFrednet:9986-move-safety-thingy, r=flip1995

Move `unnecessary_unsafety_doc` to `pedantic`

This lint was added in #9822. I like the idea, but also agree with #9986 as well. I think it should at least not be warn-by-default. This is one of these cases, where I'd like a group between pedantic and restriction. But I believe that users using `#![warn(clippy::pedantic)]` will know how to enable the lint if they disagree with it.

---

Since the lint is new:

changelog: none

r? `@flip1995` since I'd suggest back porting this, the original PR was merged 16 days ago.

Closes: #9986 (While it doesn't address everything, I believe that this is the best compromise)
19 months agoMove `unnecessary_unsafety_doc` to `pedantic`
xFrednet [Tue, 29 Nov 2022 17:22:02 +0000 (18:22 +0100)]
Move `unnecessary_unsafety_doc` to `pedantic`

19 months agoUse `snippet_with_context` instead of `_with_macro_callsite`
dswij [Wed, 30 Nov 2022 06:50:13 +0000 (14:50 +0800)]
Use `snippet_with_context` instead of `_with_macro_callsite`

19 months agoAuto merge of #9985 - ehuss:triagebot-autolabel, r=xFrednet
bors [Tue, 29 Nov 2022 13:30:15 +0000 (13:30 +0000)]
Auto merge of #9985 - ehuss:triagebot-autolabel, r=xFrednet

Add S-waiting-on-review autolabel.

This adds the S-waiting-on-review autolabel feature for new PRs.  This was previously handled by highfive, but I neglected to include it in #9963.

changelog: none

19 months agoAdd S-waiting-on-review autolabel.
Eric Huss [Tue, 29 Nov 2022 13:18:43 +0000 (05:18 -0800)]
Add S-waiting-on-review autolabel.

19 months agoAuto merge of #9975 - xFrednet:0000-refutable-slice-pedantic, r=llogiq
bors [Tue, 29 Nov 2022 11:16:01 +0000 (11:16 +0000)]
Auto merge of #9975 - xFrednet:0000-refutable-slice-pedantic, r=llogiq

Move `index_refutable_slice` to `pedantic`

During the creation, I out this lint into the nursery group to let it run in the wild before moving it to a commonly used group. This move never happened until now, though. It should be safe, as Clippy and I have been using it for months and there are no open issues for is :)

---

changelog: Move `index_refutable_slice` to `pedantic` (Now warn-by-default)
[#9975](https://github.com/rust-lang/rust-clippy/pull/9975)

19 months agoAuto merge of #9981 - Jarcho:issue_9954, r=flip1995
bors [Tue, 29 Nov 2022 09:49:46 +0000 (09:49 +0000)]
Auto merge of #9981 - Jarcho:issue_9954, r=flip1995

Don't lint `unnecessary_operation` in mixed macro contexts

fixes #9954

changelog: `unnecessary_operation`: Don't lint in mixed macro contexts.

19 months agoAuto merge of #9980 - Jarcho:issue_9960, r=xFrednet
bors [Tue, 29 Nov 2022 09:10:14 +0000 (09:10 +0000)]
Auto merge of #9980 - Jarcho:issue_9960, r=xFrednet

Don't lint `unnecessary_cast` in mixed macro context

fixes #9960

Time to start making a dent in this onslaught.

changelog: `unnecessary_cast`: Don't lint when the identifiers context differs from its binding's context for locals

19 months agoDon't lint `unnecessary_cast` in mixed macro context
Jason Newcomb [Tue, 29 Nov 2022 04:30:56 +0000 (23:30 -0500)]
Don't lint `unnecessary_cast` in mixed macro context

19 months agoDon't lint `unnecessary_operation` in mixed macro contexts
Jason Newcomb [Tue, 29 Nov 2022 04:56:02 +0000 (23:56 -0500)]
Don't lint `unnecessary_operation` in mixed macro contexts

19 months agoMove `index_refutable_slice` to `pedantic`
xFrednet [Mon, 28 Nov 2022 19:23:09 +0000 (20:23 +0100)]
Move `index_refutable_slice` to `pedantic`

19 months agoAuto merge of #9865 - nyurik:allow-mixed, r=xFrednet
bors [Mon, 28 Nov 2022 17:22:36 +0000 (17:22 +0000)]
Auto merge of #9865 - nyurik:allow-mixed, r=xFrednet

Add allow-mixed-uninlined-format-args config

Implement `allow-mixed-uninlined-format-args` config param to change the behavior of the `uninlined_format_args` lint. Now it is a part of `style` per [Zulip chat](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/.60uninlined_format_args.60.20category), and won't propose inlining in case of a mixed usage, e.g. `print!("{} {}", var, 1+2)`. If the user sets `allow-mixed-uninlined-format-args` config param to `false`, the lint would behave like it did before -- proposing to inline args even in the mixed case.

---

changelog: [`uninlined_format_args`]: Added a new config `allow-mixed-uninlined-format-args` to allow the lint, if only some arguments can be inlined
[#9865](https://github.com/rust-lang/rust-clippy/pull/9865)
changelog: Moved [`uninlined_format_args`] to `style` (Now warn-by-default)
[#9865](https://github.com/rust-lang/rust-clippy/pull/9865)

19 months agoAuto merge of #9967 - koka831:fix/9416, r=llogiq
bors [Sun, 27 Nov 2022 19:03:06 +0000 (19:03 +0000)]
Auto merge of #9967 - koka831:fix/9416, r=llogiq

Remove blank lines when needless_return returns no value

fix https://github.com/rust-lang/rust-clippy/issues/9416

changelog: [`needless_return`] improve result format

r? `@llogiq`

19 months agoAuto merge of #9963 - ehuss:highfive-triagebot, r=xFrednet
bors [Sun, 27 Nov 2022 16:20:05 +0000 (16:20 +0000)]
Auto merge of #9963 - ehuss:highfive-triagebot, r=xFrednet

Migrate from highfive to triagebot

This migrates this repository from using the highfive bot to using triagebot (aka rustbot).

This should not be merged without coordinating the removal of the highfive webhook and/or merging https://github.com/rust-lang/highfive/pull/435.

changelog: none

19 months agoaddressed review feedback
Yuri Astrakhan [Sun, 27 Nov 2022 15:34:13 +0000 (10:34 -0500)]
addressed review feedback

19 months agoMigrate from highfive to triagebot
Eric Huss [Mon, 24 Oct 2022 23:33:53 +0000 (16:33 -0700)]
Migrate from highfive to triagebot

19 months agoAdd allow-mixed-uninlined-format-args config
Yuri Astrakhan [Sun, 27 Nov 2022 15:12:51 +0000 (10:12 -0500)]
Add allow-mixed-uninlined-format-args config

Implement `allow-mixed-uninlined-format-args` config param to change the behavior of the `uninlined_format_args` lint. Now it is a part of `style`, and won't propose inlining in case of a mixed usage, e.g. `print!("{} {}", var, 1+2)`. If the user sets allow-mixed-uninlined-format-args config param to `false`, then it would behave like before, proposing to inline args even in the mixed case.

19 months agoAuto merge of #9919 - Alexendoo:configuration-link, r=xFrednet
bors [Sun, 27 Nov 2022 14:42:54 +0000 (14:42 +0000)]
Auto merge of #9919 - Alexendoo:configuration-link, r=xFrednet

Link to a list of configurable lints in documentation

changelog: none

19 months agoRefactor BytePos handling
koka [Sun, 27 Nov 2022 13:41:06 +0000 (22:41 +0900)]
Refactor BytePos handling

19 months agoRemove blank lines when needless_return returns no value
koka [Sun, 27 Nov 2022 13:01:21 +0000 (22:01 +0900)]
Remove blank lines when needless_return returns no value

fix https://github.com/rust-lang/rust-clippy/issues/9416

19 months agoAuto merge of #9860 - Alexendoo:msrv-outer-attr, r=Jarcho
bors [Sun, 27 Nov 2022 12:58:54 +0000 (12:58 +0000)]
Auto merge of #9860 - Alexendoo:msrv-outer-attr, r=Jarcho

Allow using `clippy::msrv` as an outer attribute

changelog: Allow specifying `#[clippy::msrv]` as an outer attribute

Probably not too useful to clippy users, but it makes the MSRV tests slightly cleaner

19 months agoAllow using `clippy::msrv` as an outer attribute
Alex Macleod [Sat, 19 Nov 2022 12:50:02 +0000 (12:50 +0000)]
Allow using `clippy::msrv` as an outer attribute

19 months agoLink to a list of configurable lints in documentation
Alex Macleod [Sun, 20 Nov 2022 13:27:55 +0000 (13:27 +0000)]
Link to a list of configurable lints in documentation

19 months agoAuto merge of #9950 - xFrednet:0000-improve-exit-docs, r=llogiq
bors [Sun, 27 Nov 2022 08:47:20 +0000 (08:47 +0000)]
Auto merge of #9950 - xFrednet:0000-improve-exit-docs, r=llogiq

Improve `EXIT` lint docs

Super simple change, hopefully fast and fun to review. Have a great start to the weekend!

changelog: none

19 months agoImprove `EXIT` lint docs
xFrednet [Fri, 25 Nov 2022 20:50:38 +0000 (21:50 +0100)]
Improve `EXIT` lint docs

19 months agoAuto merge of #9945 - kraktus:uninlined_multiple_lines, r=llogiq
bors [Fri, 25 Nov 2022 18:36:50 +0000 (18:36 +0000)]
Auto merge of #9945 - kraktus:uninlined_multiple_lines, r=llogiq

Re-enable `uninlined_format_args` on multiline `format!`

fix https://github.com/rust-lang/rust-clippy/issues/9719

There was an issue with the code suggestion which can be sometimes completely broken (fortunately when applied it's valid), so we do not show it.

changelog: [`uninlined_format_args`] re-enable for multiline format expression, but do not show the literal code suggestion in those cases

19 months agoAuto merge of #9944 - flip1995:move-syntax-tree-patterns, r=Manishearth
bors [Fri, 25 Nov 2022 15:59:47 +0000 (15:59 +0000)]
Auto merge of #9944 - flip1995:move-syntax-tree-patterns, r=Manishearth

Move syntax tree patterns RFC to the book

r? `@Manishearth`

Follow up to #3875

changelog: none

19 months agodogfood with expanded `uninlined_format_args`
kraktus [Fri, 25 Nov 2022 15:41:08 +0000 (16:41 +0100)]
dogfood with expanded `uninlined_format_args`

19 months agoRe-enable `uninlined_format_args` on multiline `format!`
kraktus [Fri, 25 Nov 2022 15:36:22 +0000 (16:36 +0100)]
Re-enable `uninlined_format_args` on multiline `format!`

But do not display the code suggestion which can be sometimes completely broken (fortunately when applied it's valid)

19 months agoAuto merge of #9851 - Veykril:unnecessary-safety-comment, r=giraffate
bors [Fri, 25 Nov 2022 12:55:24 +0000 (12:55 +0000)]
Auto merge of #9851 - Veykril:unnecessary-safety-comment, r=giraffate

Lint unnecessary safety comments

changelog: [`unnecessary_safety_comment`]: Add unnecessary safety comment lint

Addresses https://github.com/rust-lang/rust-clippy/issues/7954

This does not necessarily catch all occurences, as doing so would require checking all expressions in the entire source which seems rather expensive. Instead what the lint does is it checks items, statements and the tail expression of blocks for safety comments, then checks if those comments are necessary or not, then linting for the unnecessary ones.

I kept the tests in one file to check that the lints do not clash with each other.

19 months agoBook: Format syntax tree pattern proposal
Philipp Krones [Fri, 25 Nov 2022 10:39:36 +0000 (11:39 +0100)]
Book: Format syntax tree pattern proposal

19 months agoMove syntax tree patterns RFC to the book
Philipp Krones [Fri, 25 Nov 2022 10:39:04 +0000 (11:39 +0100)]
Move syntax tree patterns RFC to the book

19 months ago`manual_let_else`: Add test with expanded macros
dswij [Fri, 25 Nov 2022 10:04:31 +0000 (18:04 +0800)]
`manual_let_else`: Add test with expanded macros

19 months ago`manual_let_else`: keep macro call on suggestion blocks
dswij [Fri, 25 Nov 2022 10:04:17 +0000 (18:04 +0800)]
`manual_let_else`: keep macro call on suggestion blocks

19 months agoAddress reviews
Lukas Wirth [Thu, 24 Nov 2022 08:47:50 +0000 (09:47 +0100)]
Address reviews

19 months agoSimplify
Lukas Wirth [Thu, 17 Nov 2022 14:17:28 +0000 (15:17 +0100)]
Simplify

19 months agoLint unnecessary safety comments on statements and block tail expressions
Lukas Wirth [Thu, 17 Nov 2022 14:14:03 +0000 (15:14 +0100)]
Lint unnecessary safety comments on statements and block tail expressions

19 months agoAdd some more test cases for undocumented_unsafe_blocks
Lukas Wirth [Thu, 17 Nov 2022 10:00:51 +0000 (11:00 +0100)]
Add some more test cases for undocumented_unsafe_blocks

19 months agoLint unnecessary safety comments on items
Lukas Wirth [Mon, 14 Nov 2022 12:42:47 +0000 (13:42 +0100)]
Lint unnecessary safety comments on items

19 months agoAuto merge of #9941 - Alexendoo:syntax-tree-rfc-remark, r=Manishearth
bors [Thu, 24 Nov 2022 23:46:59 +0000 (23:46 +0000)]
Auto merge of #9941 - Alexendoo:syntax-tree-rfc-remark, r=Manishearth

Fix remark for `rfcs/0001-syntax-tree-patterns.md`

https://github.com/rust-lang/rust-clippy/actions/runs/3542472739/jobs/5948006255#step:6:37

Removes the unused definitions, for the line length I disabled the lint for now as I gather it's going to be moved into the book in the future

r? `@Manishearth`

changelog: none

19 months agoFix remark for `rfcs/0001-syntax-tree-patterns.md`
Alex Macleod [Thu, 24 Nov 2022 21:33:25 +0000 (21:33 +0000)]
Fix remark for `rfcs/0001-syntax-tree-patterns.md`

19 months agoMerge pull request #3875 from fkohlgrueber/syntax-tree-patterns
Manish Goregaokar [Wed, 23 Nov 2022 22:24:17 +0000 (17:24 -0500)]
Merge pull request #3875 from fkohlgrueber/syntax-tree-patterns

RFC: syntax tree patterns

19 months agoAuto merge of #9924 - Alexendoo:msrv-stack, r=Jarcho
bors [Tue, 22 Nov 2022 20:09:58 +0000 (20:09 +0000)]
Auto merge of #9924 - Alexendoo:msrv-stack, r=Jarcho

Add `clippy_utils::msrv::Msrv` to keep track of the current MSRV

changelog: Fix the scoping of the `#![clippy::msrv]` attribute

Fixes #6920

r? `@Jarcho`

19 months agoAuto merge of #9930 - smoelius:use-walk_generic_arg, r=Alexendoo
bors [Tue, 22 Nov 2022 19:07:05 +0000 (19:07 +0000)]
Auto merge of #9930 - smoelius:use-walk_generic_arg, r=Alexendoo

Use `walk_generic_arg`

This is a tiny followup to to #9743, now that https://github.com/rust-lang/rust/pull/103692 has landed.

r? `@Alexendoo`

changelog: none

19 months agoUse `walk_generic_arg`
Samuel Moelius [Tue, 22 Nov 2022 18:47:38 +0000 (13:47 -0500)]
Use `walk_generic_arg`

19 months agoAuto merge of #9750 - kraktus:lazy_eval, r=xFrednet
bors [Tue, 22 Nov 2022 17:21:23 +0000 (17:21 +0000)]
Auto merge of #9750 - kraktus:lazy_eval, r=xFrednet

Fix [`unnecessary_lazy_eval`] when type has significant drop

fix for https://github.com/rust-lang/rust-clippy/issues/9427#issuecomment-1295742590

However current implementation gives too many false positive, rending the lint almost useless.

I don't know what's the best way to check if a type has a "significant" drop (in the common meaning, not the internal rustc one, for example Option<(u8, u8)> should not be considered significant)

changelog: Fix [`unnecessary_lazy_eval`] when type has significant drop

19 months agoAuto merge of #9796 - smoelius:issue-9771, r=flip1995
bors [Tue, 22 Nov 2022 12:50:08 +0000 (12:50 +0000)]
Auto merge of #9796 - smoelius:issue-9771, r=flip1995

Fix #9771 (`unnecessary_to_owned` false positive)

Fixes #9771

In that issue's example(s), the lint tried to add a `&` to a value, which implicitly changed the type of a field to a reference. The fix is to add the reference to `receiver_ty` (the type of the receiver of the `to_owned`-like method), before passing `receiver_ty` to `can_change_type`. `can_change_type` properly rejects the modified `receiver_ty`.

cc: `@mikerite` just because I think he was the author of `can_change_type`.

changelog: fix `unnecessary_to_owned` false positive which implicitly tried to change the type of a field to a reference

19 months agoAuto merge of #9745 - matttpt:fix-redundant-closure-for-method-calls-suggestion,...
bors [Tue, 22 Nov 2022 09:20:50 +0000 (09:20 +0000)]
Auto merge of #9745 - matttpt:fix-redundant-closure-for-method-calls-suggestion, r=flip1995

Fix `redundant_closure_for_method_calls` suggestion

Fixes #7746. The issue turns out to be more general than raw pointers. The `redundant_closure_for_method_calls` lint produces incorrect suggestions when the method is associated with a type that must be enclosed in angle brackets or must be written with generic arguments substituted. For example:

```rust
fn main() {
    // Clippy's suggestion: [T; N]::as_slice
    // Correct suggestion:  <[u8; 3]>::as_slice
    let array_opt: Option<&[u8; 3]> = Some(&[4, 8, 7]);
    array_opt.map(|a| a.as_slice());

    // Clippy's suggestion: [T]::len
    // Correct suggestion:  <[u8]>::len
    let slice_opt: Option<&[u8]> = Some(b"slice");
    slice_opt.map(|s| s.len());

    // Clippy's suggestion: *const T::is_null
    // Correct suggestion:  <*const usize>::is_null
    let ptr_opt: Option<*const usize> = Some(&487);
    ptr_opt.map(|p| p.is_null());

    // Clippy's suggestion: dyn TestTrait::method_on_dyn
    // Correct suggestion:  <dyn TestTrait>::method_on_dyn
    let test_struct = TestStruct {};
    let dyn_opt: Option<&dyn TestTrait> = Some(&test_struct);
    dyn_opt.map(|d| d.method_on_dyn());
}

// For the trait object example:
trait TestTrait {}
struct TestStruct {}
impl TestTrait for TestStruct {}

impl dyn TestTrait + '_ {
    fn method_on_dyn(&self) -> bool {
        false
    }
}
```

The issue also affects references and tuples, though I had to patch the standard library with non-trait methods for those types to test that. Just in case, I also included handling for `!`, since it appeared to be possible to call methods on it with angle brackets. I just couldn't verify the resulting suggestion, since dead-code analysis eliminates the code first.

This is my first exposure to Rust compiler internals, so please let me know if I'm taking the wrong approach here!

changelog: [`redundant_closure_for_method_calls`]: add angle brackets and substitute generic arguments in suggestion when needed

19 months agoAuto merge of #9770 - sgued:missnamed-getters, r=llogiq
bors [Mon, 21 Nov 2022 19:51:42 +0000 (19:51 +0000)]
Auto merge of #9770 - sgued:missnamed-getters, r=llogiq

Add new lint  [`misnamed-getters`]

```
changelog: Add new lint  [`misnamed-getters`]
```

Closes #9769

The current lint matches all methods with a body of just one expression under the form `(&mut?)? <expr>.field` where field doesn't match the name of the method but there is a field of the same type in `<expr>` that matches the name. This allows matching nested structs, for example for newtype wrappers. This may cast the net a bit too wide and cause false positives. I'll run [clippy_lint_tester](https://github.com/mikerite/clippy_lint_tester) on the top crates to see how frequently false positives happen.

There also may be room for improvement by checking that the replacement field would work taking into account implementations of `Deref` and `DerefMut` even if the types don't exactly match but I don't know yet how this could be done.

19 months agoAuto merge of #9881 - flip1995:rustup, r=flip1995
bors [Mon, 21 Nov 2022 19:16:14 +0000 (19:16 +0000)]
Auto merge of #9881 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

It took >4 weeks, but I finally got to do the sync đźŽ‰

changelog: none

19 months agoFix custom ICE message test on windows
Philipp Krones [Mon, 21 Nov 2022 19:15:50 +0000 (20:15 +0100)]
Fix custom ICE message test on windows

19 months agopass clippy sysroot env if given r=ozkanonur
ozkanonur [Sat, 19 Nov 2022 23:40:31 +0000 (02:40 +0300)]
pass clippy sysroot env if given r=ozkanonur

Signed-off-by: ozkanonur <work@onurozkan.dev>
19 months agoBump nightly version -> 2022-11-21
Philipp Krones [Mon, 21 Nov 2022 19:02:14 +0000 (20:02 +0100)]
Bump nightly version -> 2022-11-21

19 months agoBump Clippy version -> 0.1.67
Philipp Krones [Mon, 21 Nov 2022 19:02:06 +0000 (20:02 +0100)]
Bump Clippy version -> 0.1.67

19 months agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Mon, 21 Nov 2022 18:59:07 +0000 (19:59 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

19 months agoAdd `clippy_utils::msrv::Msrv` to keep track of the current MSRV
Alex Macleod [Mon, 21 Nov 2022 14:37:51 +0000 (14:37 +0000)]
Add `clippy_utils::msrv::Msrv` to keep track of the current MSRV

19 months agoFix [`unnecessary_lazy_eval`] when type has significant drop
kraktus [Sat, 29 Oct 2022 19:45:40 +0000 (21:45 +0200)]
Fix [`unnecessary_lazy_eval`] when type has significant drop

19 months agoAuto merge of #9873 - smoelius:move-line-span, r=flip1995
bors [Mon, 21 Nov 2022 11:07:32 +0000 (11:07 +0000)]
Auto merge of #9873 - smoelius:move-line-span, r=flip1995

Move `line_span` to source.rs

`line_span` is a non-public function used only in source.rs. It seems like it ought to go in source.rs.

changelog: none

19 months agoAuto merge of #9592 - c410-f3r:arith, r=Jarcho
bors [Sun, 20 Nov 2022 22:51:25 +0000 (22:51 +0000)]
Auto merge of #9592 - c410-f3r:arith, r=Jarcho

[arithmetic-side-effects] Detect overflowing associated constants of integers

Triggers the negation of maximum unsigned integers using associated constants. Rustc already handles `-128i8` but doesn't handle `-i8::MAX`.

At the same time, allows stuff like `-1234`.

changelog: FP: [arithmetic-side-effects] Detect overflowing associated constants of integers

19 months agoAuto merge of #9870 - koka831:unformat-unused-rounding, r=Jarcho
bors [Sun, 20 Nov 2022 22:09:25 +0000 (22:09 +0000)]
Auto merge of #9870 - koka831:unformat-unused-rounding, r=Jarcho

Keep original literal notation in suggestion

While I did some investigation of https://github.com/rust-lang/rust-clippy/issues/9866 (I couldn't reproduce it though) I found that `unused_rounding` formats as follows:

```rust
3.0_f64.round() // => 3.0f64
```

This PR makes them preserve as the original notation.

```rust
3.0_f64.round() // => 3.0_f64
```

changelog: Suggestion Enhancement: [`unused_rounding`]: The suggestion now preserves the original float literal notation

19 months agoFix many false negatives caused by autoderef
Sosthène Guédon [Sun, 20 Nov 2022 16:03:53 +0000 (17:03 +0100)]
Fix many false negatives caused by autoderef

19 months agoImprove diagnostic for cases where autoderef is used
Sosthène Guédon [Sun, 20 Nov 2022 14:34:56 +0000 (15:34 +0100)]
Improve diagnostic for cases where autoderef is used

19 months agoAuto merge of #9879 - Alexendoo:allow, r=Manishearth
bors [Sun, 20 Nov 2022 13:17:02 +0000 (13:17 +0000)]
Auto merge of #9879 - Alexendoo:allow, r=Manishearth

Fix `#[allow]` for `module_name_repetitions` & `single_component_path_imports`

Fixes #7511
Fixes #8768
Fixes #9401

`single_component_path_imports` needed some changes to the lint itself, it now buffers the found single component paths to emit in the equivalent `check_item`

changelog: Fix `#[allow(clippy::module_name_repetitions)]` and `#[allow(clippy::single_component_path_imports)]`

19 months agomisname-getters: Fix documentation
Sosthène Guédon [Sun, 20 Nov 2022 12:46:30 +0000 (13:46 +0100)]
misname-getters: Fix documentation

19 months agoRemove error when fields use autoderef
Sosthène Guédon [Sun, 20 Nov 2022 11:20:16 +0000 (12:20 +0100)]
Remove error when fields use autoderef

19 months agoAdd failing test
Sosthène Guédon [Sat, 12 Nov 2022 21:33:46 +0000 (22:33 +0100)]
Add failing test

19 months agomisnamed_getters: Trigger on unsafe with _unchecked
Sosthène Guédon [Wed, 2 Nov 2022 18:11:27 +0000 (19:11 +0100)]
misnamed_getters: Trigger on unsafe with _unchecked

19 months agoImprove code
Sosthène Guédon [Wed, 2 Nov 2022 18:02:46 +0000 (19:02 +0100)]
Improve code

19 months agoFix typo missnamed -> misnamed
Sosthène Guédon [Wed, 2 Nov 2022 08:01:33 +0000 (09:01 +0100)]
Fix typo missnamed -> misnamed

19 months agoFix internal warnings
Sosthène Guédon [Tue, 1 Nov 2022 20:49:20 +0000 (21:49 +0100)]
Fix internal warnings

19 months agoDocument missname_getters
Sosthène Guédon [Tue, 1 Nov 2022 20:36:18 +0000 (21:36 +0100)]
Document missname_getters

19 months agomissnamed_getters: use all_fields iterator
Sosthène Guédon [Tue, 1 Nov 2022 18:31:47 +0000 (19:31 +0100)]
missnamed_getters: use all_fields iterator

19 months agoFix suggestion to point to the whole method
Sosthène Guédon [Tue, 1 Nov 2022 18:28:06 +0000 (19:28 +0100)]
Fix suggestion to point to the whole method

19 months agomissnamed_getters: Match owned methods
Sosthène Guédon [Tue, 1 Nov 2022 18:07:51 +0000 (19:07 +0100)]
missnamed_getters: Match owned methods

19 months agoAdd missnamed_getters lint
Sosthène Guédon [Tue, 1 Nov 2022 17:39:36 +0000 (18:39 +0100)]
Add missnamed_getters lint

19 months agoFix `#[allow]` for module_name_repetitions & single_component_path_imports
Alex Macleod [Sat, 19 Nov 2022 18:13:17 +0000 (18:13 +0000)]
Fix `#[allow]` for module_name_repetitions & single_component_path_imports

19 months agoAuto merge of #98914 - fee1-dead-contrib:min-deref-patterns, r=compiler-errors
bors [Sun, 20 Nov 2022 07:16:42 +0000 (07:16 +0000)]
Auto merge of #98914 - fee1-dead-contrib:min-deref-patterns, r=compiler-errors

Minimal implementation of implicit deref patterns for Strings

cc `@compiler-errors` `@BoxyUwU` https://github.com/rust-lang/lang-team/issues/88 #87121

~~I forgot to add a feature gate, will do so in a minute~~ Done

19 months agoRollup merge of #104593 - compiler-errors:rpitit-object-safety-spans, r=fee1-dead
Matthias KrĂĽger [Sat, 19 Nov 2022 14:35:23 +0000 (15:35 +0100)]
Rollup merge of #104593 - compiler-errors:rpitit-object-safety-spans, r=fee1-dead

Improve spans for RPITIT object-safety errors

No reason why we can't point at the `impl Trait` that causes the object-safety violation.

Also [drive-by: Add is_async fn to hir::IsAsync](https://github.com/rust-lang/rust/pull/104593/commits/c4165f3a965e258531928180195637455299c6f3), which touches clippy too.

19 months agorefac: grab a snip from receiver
koka [Sat, 19 Nov 2022 12:21:47 +0000 (21:21 +0900)]
refac: grab a snip from receiver

19 months agoRemove unused
Caio [Sat, 19 Nov 2022 11:25:20 +0000 (08:25 -0300)]
Remove unused

19 months ago[arithmetic-side-effects] Detect overflowing associated constants of integers
Caio [Sat, 19 Nov 2022 11:22:27 +0000 (08:22 -0300)]
[arithmetic-side-effects] Detect overflowing associated constants of integers

19 months agoMove `line_span` to source.rs
Samuel Moelius [Fri, 18 Nov 2022 18:18:58 +0000 (18:18 +0000)]
Move `line_span` to source.rs

19 months agoAuto merge of #9800 - Alexendoo:def_path_res_multiple, r=dswij
bors [Sat, 19 Nov 2022 09:05:50 +0000 (09:05 +0000)]
Auto merge of #9800 - Alexendoo:def_path_res_multiple, r=dswij

Return multiple resolutions from `def_path_res`

Changes `def_path_res` to return all the resolutions matching the path rather than the first one (with a namespace hint that covered some cases).  This would fix any issues that come up with multiple versions of the same crate being present as they all have the same crate name

It also adds resolution of `impl _ {}` items for local items, and removes struct field resolution as it didn't seem to be used anywhere

I tested it on a local crate and it worked for the multiple crate issue, but I couldn't come up with a test that worked well with `// aux-build`, maybe `// aux-crate` after https://github.com/rust-lang/rust/pull/103266 could work but I'm not sure on that either

changelog: [`disallowed_methods`], [`disallowed_types`], [`disallowed_macros`]: fix path resolution with multiple versions of the same crate
changelog: [`disallowed_methods`]: Resolve methods in `impl`s in the current crate

19 months agodrive-by: Add is_async fn to hir::IsAsync
Michael Goulet [Sat, 19 Nov 2022 02:22:24 +0000 (02:22 +0000)]
drive-by: Add is_async fn to hir::IsAsync

19 months agoAuto merge of #104573 - matthiaskrgr:rollup-k36ybtp, r=matthiaskrgr
bors [Fri, 18 Nov 2022 20:26:58 +0000 (20:26 +0000)]
Auto merge of #104573 - matthiaskrgr:rollup-k36ybtp, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #101162 (Migrate rustc_resolve to use SessionDiagnostic, part # 1)
 - #103386 (Don't allow `CoerceUnsized` into `dyn*` (except for trait upcasting))
 - #103405 (Detect incorrect chaining of if and if let conditions and recover)
 - #103594 (Fix non-associativity of `Instant` math on `aarch64-apple-darwin` targets)
 - #104006 (Add variant_name function to `LangItem`)
 - #104494 (Migrate GUI test to use functions)
 - #104516 (rustdoc: clean up sidebar width CSS)
 - #104550 (fix a typo)

Failed merges:

 - #104554 (Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less)

r? `@ghost`
`@rustbot` modify labels: rollup

19 months agoAuto merge of #101562 - nnethercote:shrink-ast-Expr-harder, r=petrochenkov
bors [Fri, 18 Nov 2022 16:56:12 +0000 (16:56 +0000)]
Auto merge of #101562 - nnethercote:shrink-ast-Expr-harder, r=petrochenkov

Shrink `ast::Expr` harder

r? `@ghost`

19 months agoAuto merge of #9871 - koka831:fix/9864, r=xFrednet
bors [Fri, 18 Nov 2022 16:04:18 +0000 (16:04 +0000)]
Auto merge of #9871 - koka831:fix/9864, r=xFrednet

Allow manual swap in const fn

Fix https://github.com/rust-lang/rust-clippy/issues/9864

changelog: Fix [`manual_swap`]: No longer lints in constant code

19 months agoNote about const fn
koka [Fri, 18 Nov 2022 15:28:02 +0000 (00:28 +0900)]
Note about const fn

Since `std::mem::swap` is not stable as a const fn, the suggestion
would not be applicable in that cases

19 months agoAuto merge of #9855 - Alexendoo:needless-borrowed-ref-extra, r=xFrednet
bors [Fri, 18 Nov 2022 14:26:50 +0000 (14:26 +0000)]
Auto merge of #9855 - Alexendoo:needless-borrowed-ref-extra, r=xFrednet

Extend `needless_borrowed_reference` to structs and tuples, ignore _

changelog: [`needless_borrowed_reference`]: Lint struct and tuple patterns, and patterns containing `_`

Now lints patterns like

```rust
&(ref a, ref b)
&Tuple(ref a, ref b)
&Struct { ref a, ref b }

&(ref a, _)
```