]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRemove paths::PATH_BUF
Cameron Steffen [Thu, 1 Apr 2021 15:24:44 +0000 (10:24 -0500)]
Remove paths::PATH_BUF

3 years agoRemove get_node_span
Cameron Steffen [Thu, 1 Apr 2021 14:51:31 +0000 (09:51 -0500)]
Remove get_node_span

3 years agoAuto merge of #6931 - Jarcho:needless_borrow, r=phansch,flip1995
bors [Tue, 6 Apr 2021 15:30:48 +0000 (15:30 +0000)]
Auto merge of #6931 - Jarcho:needless_borrow, r=phansch,flip1995

Fix all occurences `needless_borrow` internally

The bug that got 'needless_borrow' moved into the nursery was fixed two years ago in d4370f8b.

This did trigger over a thousand times internally, so that's all the other changes. I vetted most of them, but there's a lot The only interesting change is to the lint list. `declare_tool_lint` already makes a reference, so there's no need to take a reference to the lints.

changelog: None

3 years agoFix all occurences of `needless_borrow` internally
Jason Newcomb [Fri, 2 Apr 2021 21:35:32 +0000 (17:35 -0400)]
Fix all occurences of `needless_borrow` internally

3 years agoAuto merge of #7036 - horacimacias:master, r=giraffate
bors [Tue, 6 Apr 2021 13:38:08 +0000 (13:38 +0000)]
Auto merge of #7036 - horacimacias:master, r=giraffate

consider mutability on useless_vec suggestions

fixes #7035

changelog: Now the suggested by `useless_vec` considers mutability to suggest either `&[]`, as before, or `&mut []` if the used reference is mutable.

3 years agoconsider mutability on useless_vec suggestions
Horaci Macias [Mon, 5 Apr 2021 11:27:39 +0000 (13:27 +0200)]
consider mutability on useless_vec suggestions
https://github.com/rust-lang/rust-clippy/issues/7035

3 years agoAuto merge of #7018 - Y-Nak:same_item_push, r=Manishearth
bors [Mon, 5 Apr 2021 22:57:33 +0000 (22:57 +0000)]
Auto merge of #7018 - Y-Nak:same_item_push, r=Manishearth

Don't trigger `same_item_push` if the vec is used in the loop body

fixes #6987
changelog: `same_item_push`: Don't trigger if the `vec` is used in the loop body

3 years agoAuto merge of #7029 - ABouttefeux:master, r=Manishearth
bors [Mon, 5 Apr 2021 19:14:55 +0000 (19:14 +0000)]
Auto merge of #7029 - ABouttefeux:master, r=Manishearth

fix `missing_panics_doc` not detecting `assert_eq!` and `assert_ne!`

fixes #6997
changelog: `missing_panics_doc` detects `assert_eq!` and `assert_ne!`

---
searching for `assert_eq!` and `assert_ne!` in `FindPanicUnwrap`

3 years agoAuto merge of #6463 - xFrednet:5234-shared-code-in-if-blocks, r=phansch
bors [Mon, 5 Apr 2021 19:00:41 +0000 (19:00 +0000)]
Auto merge of #6463 - xFrednet:5234-shared-code-in-if-blocks, r=phansch

New Lint: `branches_sharing_code`

This lint checks if all `if`-blocks contain some statements that are the same and can be moved out of the blocks to prevent code duplication. Here is an example:

```rust
let _ = if ... {
    println!("Start"); // <-- Lint for code duplication
    let _a = 99;
    println!("End"); // <-- Lint for code duplication
    false
} else {
    println!("Start");
    let _b = 17;
    println!("End");
    false
};
```

This could be written as:

```rust
println!("Start");

let _ = if ... {
    let _a = 99;
    false
} else {
    let _b = 17;
    false
};

println!("End");
```

---

This lint will get masked by the `IF_SAME_THEN_ELSE` lint. I think it makes more sense to only emit one lint per if block. This means that the folloing example:

```rust
if ... {
    let _a = 17;
} else {
    let _a = 17;
}
```

Will only trigger the `IF_SAME_THEN_ELSE` lint and not the `SHARED_CODE_IN_IF_BLOCKS` lint.

---

closes: #5234

changelog: Added a new lint: `branches_sharing_code`

And hello to the one that is writing the changelog for this release :D

3 years agoAuto merge of #7026 - daxpedda:cargo-author, r=camsteffen
bors [Mon, 5 Apr 2021 18:02:32 +0000 (18:02 +0000)]
Auto merge of #7026 - daxpedda:cargo-author, r=camsteffen

Remove author requirement for `cargo_common_metadata`

This PR follows https://github.com/rust-lang/cargo/pull/9282, I'm not fully informed about all of this, it would be great if somebody knowledgeable about this topic agrees.

changelog: Changed `cargo_common_metadata` to stop linting on the optional author field.

3 years agoRenaming the lint to branches_sharing_code and fixing typos
xFrednet [Thu, 1 Apr 2021 16:30:47 +0000 (18:30 +0200)]
Renaming the lint to branches_sharing_code and fixing typos

3 years agoTest for empty blocks and update from master
xFrednet [Fri, 5 Mar 2021 18:23:12 +0000 (19:23 +0100)]
Test for empty blocks and update from master

3 years agoOnly running shared_code_in_if_blocks only for if statements
xFrednet [Fri, 26 Feb 2021 20:29:55 +0000 (21:29 +0100)]
Only running shared_code_in_if_blocks only for if statements

3 years agoMoving shared_code_in_if_blocks to clippy::complexity and running lintcheck
xFrednet [Thu, 25 Feb 2021 22:33:46 +0000 (23:33 +0100)]
Moving shared_code_in_if_blocks to clippy::complexity and running lintcheck

3 years agoAdapted the lint to use the new SpanlessEq
xFrednet [Tue, 23 Feb 2021 20:16:19 +0000 (21:16 +0100)]
Adapted the lint to use the new SpanlessEq

3 years agoUpdated code for dogfood
xFrednet [Sat, 16 Jan 2021 20:04:47 +0000 (21:04 +0100)]
Updated code for dogfood

3 years agoImproved shared_code_in_if_blocks message and added test stderrs
xFrednet [Sat, 16 Jan 2021 19:37:50 +0000 (20:37 +0100)]
Improved shared_code_in_if_blocks message and added test stderrs

3 years agoImproved shared_code_in_if_blocks output readability and added tests
xFrednet [Sat, 16 Jan 2021 13:04:14 +0000 (14:04 +0100)]
Improved shared_code_in_if_blocks output readability and added tests

3 years agoThe shared_code_in_if_blocks lint only operats on entire if expr not else ifs
xFrednet [Wed, 13 Jan 2021 19:01:15 +0000 (20:01 +0100)]
The shared_code_in_if_blocks lint only operats on entire if expr not else ifs

3 years agoA new lint for shared code in if blocks
xFrednet [Fri, 11 Dec 2020 22:29:53 +0000 (22:29 +0000)]
A new lint for shared code in if blocks

* Added expression check for shared_code_in_if_blocks
* Finishing touches for the shared_code_in_if_blocks lint
* Applying PR suggestions
* Update lints yay
* Moved test into subfolder

3 years agoAdded documentation to the multispan_sugg method
xFrednet [Tue, 5 Jan 2021 22:59:14 +0000 (23:59 +0100)]
Added documentation to the multispan_sugg method

3 years agoAuto merge of #7034 - Jarcho:missing_doc_ice, r=phansch
bors [Mon, 5 Apr 2021 09:27:18 +0000 (09:27 +0000)]
Auto merge of #7034 - Jarcho:missing_doc_ice, r=phansch

Fix ICE in `missing_panics_doc`

fixes: #7033
changelog: Fix ICE in `missing_panics_doc` while searching in a `const` block

3 years agoAuto merge of #7027 - camsteffen:defidmap, r=phansch
bors [Mon, 5 Apr 2021 09:15:08 +0000 (09:15 +0000)]
Auto merge of #7027 - camsteffen:defidmap, r=phansch

Use DefIdMap and similar aliases

changelog: none

3 years agoAuto merge of #7031 - xFrednet:5234-quick-fix-dark-mode-themes, r=llogiq
bors [Mon, 5 Apr 2021 07:45:05 +0000 (07:45 +0000)]
Auto merge of #7031 - xFrednet:5234-quick-fix-dark-mode-themes, r=llogiq

Quick fix for the updated website theaming to access the correct css files

This fixes a problem from #7030 that the service used to access css files was blocked by GitHub pages due to `SSL_ERROR_BAD_CERT_DOMAIN`. The css file loading worked fine during local development. The browser probably disabled some security options due to the local address.

This fix works locally and should also work online as it references the direct css files used by the [mdBook User Guide](https://rust-lang.github.io/mdBook/index.html) the disadvantage of this is that refactorings within the mdBook project can have effects on the theme loading of Clippy. This PR is therefor more meant as a quick fix until I find a better solution.

I've tested these changes using the page editor in the browser and can now confirm that they work :)

changelog: none

r?  `@llogiq`

3 years agoadd test for missing_panic_doc on assert_eq/assert_ne
Aliénore Bouttefeux [Mon, 5 Apr 2021 07:16:48 +0000 (09:16 +0200)]
add test for missing_panic_doc on assert_eq/assert_ne

3 years agoFix ICE in `missing_panics_doc`
Jason Newcomb [Mon, 5 Apr 2021 04:09:13 +0000 (00:09 -0400)]
Fix ICE in `missing_panics_doc`

3 years agoAuto merge of #7021 - camsteffen:7012, r=giraffate
bors [Sun, 4 Apr 2021 23:51:31 +0000 (23:51 +0000)]
Auto merge of #7021 - camsteffen:7012, r=giraffate

Fix ICE #7012

changelog: none

Fixes #7012

3 years agoQuick fix to access the correct css files
xFrednet [Sun, 4 Apr 2021 18:05:14 +0000 (20:05 +0200)]
Quick fix to access the correct css files

3 years agoAuto merge of #7030 - xFrednet:6877-clippy-going-dark, r=llogiq
bors [Sun, 4 Apr 2021 16:59:14 +0000 (16:59 +0000)]
Auto merge of #7030 - xFrednet:6877-clippy-going-dark, r=llogiq

Clippy going dark: Adding a dark theme to Clippy's lint list

This PR adds the MdBook color themes to the lint list of Clippy. Well at least an adaption of these themes.

<details>
<summary>Here are some beautiful screenshots:</summary>

**light theme**
![image](https://user-images.githubusercontent.com/17087237/113510593-e31fb280-955b-11eb-8ab1-8b5bcf287475.png)

**Rust theme**
![image](https://user-images.githubusercontent.com/17087237/113510734-79ec6f00-955c-11eb-981c-8ebe890acf79.png)

**Coal theme**
![image](https://user-images.githubusercontent.com/17087237/113510752-8ec90280-955c-11eb-8f5c-c87ca07c35c2.png)

**Navy theme**
![image](https://user-images.githubusercontent.com/17087237/113510675-3f82d200-955c-11eb-8992-8c784abe19ea.png)

**Ayu theme**
![image](https://user-images.githubusercontent.com/17087237/113510700-588b8300-955c-11eb-83e0-a8f770e9f913.png)

</details>

The theme is also stored in the browser to ensure that the next session applies the theme and doesn't burn your eyes out.

cc: `@matthiaskrgr`

---

Closes #6877

changelog: [Clippy's lint list](https://rust-lang.github.io/rust-clippy/master/index.html) now supports themes

3 years agoAdding a dark theme to the clippy lint list
xFrednet [Fri, 2 Apr 2021 16:35:11 +0000 (18:35 +0200)]
Adding a dark theme to the clippy lint list

3 years agomodification not working: fixing
Aliénore Bouttefeux [Sun, 4 Apr 2021 11:03:05 +0000 (13:03 +0200)]
modification not working: fixing

3 years agoadded core::panicking::assert_failed_inner as panicking
Aliénore Bouttefeux [Sun, 4 Apr 2021 09:56:45 +0000 (11:56 +0200)]
added core::panicking::assert_failed_inner as panicking

3 years agoUse DefIdMap and similar aliases
Cameron Steffen [Wed, 31 Mar 2021 21:39:09 +0000 (16:39 -0500)]
Use DefIdMap and similar aliases

3 years agoRemove author requirement for `cargo_common_metadata`
daxpedda [Sat, 3 Apr 2021 20:52:48 +0000 (22:52 +0200)]
Remove author requirement for `cargo_common_metadata`

3 years agoFix ICE
Cameron Steffen [Fri, 2 Apr 2021 16:56:32 +0000 (11:56 -0500)]
Fix ICE

3 years agoAuto merge of #7020 - camsteffen:needless-collect, r=Manishearth
bors [Fri, 2 Apr 2021 15:27:54 +0000 (15:27 +0000)]
Auto merge of #7020 - camsteffen:needless-collect, r=Manishearth

Improve needless_collect output

changelog: Improve needless_collect output

Fixes #6908
Partially addresses #6164

3 years agoImprove needless_collect output
Cameron Steffen [Fri, 2 Apr 2021 15:03:35 +0000 (10:03 -0500)]
Improve needless_collect output

3 years agoAuto merge of #7016 - camsteffen:bind-map-paths, r=Manishearth
bors [Fri, 2 Apr 2021 15:10:24 +0000 (15:10 +0000)]
Auto merge of #7016 - camsteffen:bind-map-paths, r=Manishearth

Remove paths from bind_instead_of_map

changelog: none

3 years agoRemove redundant emit()
Cameron Steffen [Fri, 2 Apr 2021 14:38:13 +0000 (09:38 -0500)]
Remove redundant emit()

3 years agoRefactor needless_collect
Cameron Steffen [Fri, 2 Apr 2021 13:37:03 +0000 (08:37 -0500)]
Refactor needless_collect

3 years agoAuto merge of #6988 - mikerite:fix-6984, r=camsteffen
bors [Fri, 2 Apr 2021 12:42:40 +0000 (12:42 +0000)]
Auto merge of #6988 - mikerite:fix-6984, r=camsteffen

Fix hidden variant suggestion on single variant

Fixes #6984

changelog: Fix hidden variant suggestion on `match_wildcard_for_single_variants`

3 years agosame_item_push: Don't trigger same_item_push if the vec is used in the loop body
Yoshitomo Nakanishi [Fri, 2 Apr 2021 04:45:38 +0000 (13:45 +0900)]
same_item_push: Don't trigger same_item_push if the vec is used in the loop body

3 years agoRemove paths from bind_instead_of_map
Cameron Steffen [Thu, 1 Apr 2021 17:15:47 +0000 (12:15 -0500)]
Remove paths from bind_instead_of_map

3 years agoAuto merge of #7013 - Y-Nak:fix-needless-paren, r=flip1995
bors [Thu, 1 Apr 2021 15:09:46 +0000 (15:09 +0000)]
Auto merge of #7013 - Y-Nak:fix-needless-paren, r=flip1995

clippy_utils: fix needless parenthesis output from sugg::Sugg::maybe_par

changelog: clippy_utils: fix needless parenthesis output from `sugg::Sugg::maybe_par`

fixes: #6767

3 years agoAuto merge of #7011 - Jarcho:redundant_clone_fp, r=flip1995
bors [Thu, 1 Apr 2021 14:06:04 +0000 (14:06 +0000)]
Auto merge of #7011 - Jarcho:redundant_clone_fp, r=flip1995

Fix `redundant_clone` fp

fixes: #5973
fixes: #5595
fixes: #6998

changelog: Fix `redundant_clone` fp  where the cloned value is modified while the clone is in use.

3 years agoAuto merge of #7002 - mgacek8:issue6983_wrong_self_convention_inside_trait_impls...
bors [Thu, 1 Apr 2021 05:48:16 +0000 (05:48 +0000)]
Auto merge of #7002 - mgacek8:issue6983_wrong_self_convention_inside_trait_impls, r=phansch

wrong_self_convention: fix FP inside trait impl for `to_*` method taking `&self`

fixes #6983
changelog: `wrong_self_convention`: fix FP inside trait impl for `to_*` method taking `&self`

3 years agoAuto merge of #6976 - Jarcho:manual_map_const, r=phansch
bors [Thu, 1 Apr 2021 05:34:34 +0000 (05:34 +0000)]
Auto merge of #6976 - Jarcho:manual_map_const, r=phansch

Don't lint `manual_map` in const functions

fixes: #6967

changelog: Don't lint `manual_map` in const functions

3 years agoclippy_utils: fix needless parenthesis output from sugg::Sugg::maybe_par
Yoshitomo Nakanishi [Thu, 1 Apr 2021 01:39:44 +0000 (10:39 +0900)]
clippy_utils: fix needless parenthesis output from sugg::Sugg::maybe_par

3 years agoAuto merge of #7010 - camsteffen:if-chain-lint, r=llogiq
bors [Wed, 31 Mar 2021 21:57:48 +0000 (21:57 +0000)]
Auto merge of #7010 - camsteffen:if-chain-lint, r=llogiq

Internal `if_chain!` lints

changelog: none

We use `if_chain!` a lot. So this enforces some style rules around it, internal only.

Lints when...
* Nested `if`/`if_chain!` can be collapsed
* An `if_chain!` starts with `let` or ends with `let ..; then {..}`
* An `if_chain!` has only one `if`
* An `if_chain!` contains `if .. && ..;` that spans multiple lines

3 years agoFix `redundant_clone` fp where the cloned value is modified while the clone is in...
Jason Newcomb [Wed, 31 Mar 2021 18:58:17 +0000 (14:58 -0400)]
Fix `redundant_clone` fp where the cloned value is modified while the clone is in use.

3 years agoEat dogfood
Cameron Steffen [Tue, 30 Mar 2021 19:59:59 +0000 (14:59 -0500)]
Eat dogfood

3 years agoAdd if_chain lints
Cameron Steffen [Tue, 30 Mar 2021 18:35:30 +0000 (13:35 -0500)]
Add if_chain lints

3 years agoAuto merge of #7008 - matthiaskrgr:ltchk, r=camsteffen
bors [Wed, 31 Mar 2021 18:58:52 +0000 (18:58 +0000)]
Auto merge of #7008 - matthiaskrgr:ltchk, r=camsteffen

lintcheck: warn if we get a bad exit status while running clippy

Right now we won't notice if a crate fails to build.
Print a warning message to indicate that there is a problem of some sort.
I'll still have to do more investigation on why this actually happens.

I suspect that the problem is that `clippy fix` might run  --all-targets  but when we download the crate source from crates.io, some path deps (used for internal tests etc...) are not available (which is usually not a problem because the internal tests are not needed when using the crate as a lib..?)

changelog: none

3 years agoAuto merge of #6913 - camsteffen:method-chain, r=flip1995
bors [Wed, 31 Mar 2021 18:30:32 +0000 (18:30 +0000)]
Auto merge of #6913 - camsteffen:method-chain, r=flip1995

Destructure args in `methods`

changelog: none

This changes the main pattern in `methods` to match and destructure the method call args at the same time as the method name, and pass individual arg `Expr`s to the lint impls.

```rust
// before
["expect", ..] => expect::check(cx, expr, arg_lists[0]);
// after
("expect", [arg]) => expect::check(cx, expr, recv, arg);
```

This makes the code safer since there is no risk of out of bounds `args[n]` everywhere. There will be no more collecting `method_names`, `arg_lists`, `method_spans` as a separate step - everything comes out of the `match`es. Chained methods are parsed in a nested `match`. This makes the code more verbose in some ways, but IMO it is much easier to follow.

~Definitely should wait for #6896. Just putting out the idea.~

3 years agoDestructure args in methods module
Cameron Steffen [Thu, 11 Mar 2021 05:40:20 +0000 (23:40 -0600)]
Destructure args in methods module

3 years agoAuto merge of #6342 - bbqbaron:issue-6061, r=flip1995
bors [Wed, 31 Mar 2021 16:19:07 +0000 (16:19 +0000)]
Auto merge of #6342 - bbqbaron:issue-6061, r=flip1995

Lint: filter(Option::is_some).map(Option::unwrap)

Fixes #6061

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog:
* add new lint for filter(Option::is_some).map(Option::unwrap)

First Rust PR, so I'm sure I've violated some idioms. Happy to change anything.

I'm getting one test failure locally -- a stderr diff for `compile_test`. I'm having a hard time seeing how I could be causing it, so I'm tentatively opening this in the hopes that it's an artifact of my local setup against `rustc`. Hoping it can at least still be reviewed in the meantime.

I'm gathering that since this is a method lint, and `.filter(...).map(...)` is already checked, the means of implementation needs to be a little different, so I didn't exactly follow the setup boilerplate. My way of checking for method calls seems a little too direct (ie, "is the second element of the expression literally the path for `Option::is_some`?"), but it seems like that's how some other lints work, so I went with it. I'm assuming we're not concerned about, eg, closures that just end up equivalent to `Option::is_some` by eta reduction.

3 years agoAuto merge of #6706 - Y-Nak:excessive-for-each, r=camsteffen
bors [Wed, 31 Mar 2021 15:59:55 +0000 (15:59 +0000)]
Auto merge of #6706 - Y-Nak:excessive-for-each, r=camsteffen

New Lint: needless_for_each

resolves: #6543

changelog: Added pedantic lint: `needless_for_each`

3 years agoSuggest `flatten` instead of `is_some` -> `unwrap`
Eric Loren [Sun, 15 Nov 2020 00:47:17 +0000 (19:47 -0500)]
Suggest `flatten` instead of `is_some` -> `unwrap`

3 years agoTweak a suggestion message of needless_for_each
Yoshitomo Nakanishi [Mon, 15 Mar 2021 03:01:39 +0000 (12:01 +0900)]
Tweak a suggestion message of needless_for_each

3 years agoSkip needless_for_each if an input stmt is local
Yoshitomo Nakanishi [Sun, 14 Mar 2021 01:22:28 +0000 (10:22 +0900)]
Skip needless_for_each if an input stmt is local

3 years agoFix codes that make dogfood fail
Yoshitomo Nakanishi [Sat, 13 Mar 2021 06:23:57 +0000 (15:23 +0900)]
Fix codes that make dogfood fail

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 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 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 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 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