]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #7068 - boxdot:remove-std-ptr-null, r=camsteffen
bors [Mon, 12 Apr 2021 18:37:31 +0000 (18:37 +0000)]
Auto merge of #7068 - boxdot:remove-std-ptr-null, r=camsteffen

Remove paths::STD_PTR_NULL

Related to #5393

changelog: none

3 years agoAuto merge of #7067 - TaKO8Ki:fix-false-negative-on-needless-return, r=llogiq
bors [Mon, 12 Apr 2021 18:00:38 +0000 (18:00 +0000)]
Auto merge of #7067 - TaKO8Ki:fix-false-negative-on-needless-return, r=llogiq

Fix a false negative on `needless return`

closes #7042

changelog: fix a false negative on `needless return`

3 years agoRemove paths::STD_PTR_NULL
boxdot [Mon, 12 Apr 2021 16:34:16 +0000 (18:34 +0200)]
Remove paths::STD_PTR_NULL

3 years agoAuto merge of #7064 - ThibsG:WrongSelfFix, r=giraffate
bors [Mon, 12 Apr 2021 14:16:17 +0000 (14:16 +0000)]
Auto merge of #7064 - ThibsG:WrongSelfFix, r=giraffate

Fix FP in `wrong_self_convention` lint

Previously, this lint didn't check into impl block when it was implementing a trait.
Recent improvements (#6924) have moved this check and some impl blocks are now checked but they shouldn't, such as in #7032.

Fixes #7032

changelog: Fix FP when not taking `self` in impl block for `wrong_self_convention` lint

3 years agofix limit_stderr_length error
Takayuki [Mon, 12 Apr 2021 12:58:34 +0000 (21:58 +0900)]
fix limit_stderr_length error

3 years agoadd tests for a false negative on `needless_return`
Takayuki [Mon, 12 Apr 2021 12:37:19 +0000 (21:37 +0900)]
add tests for a false negative on `needless_return`

3 years agofix a false negative on `needless_return`
Takayuki [Mon, 12 Apr 2021 12:36:49 +0000 (21:36 +0900)]
fix a false negative on `needless_return`

3 years agoAuto merge of #6982 - Jarcho:explicit_into_iter_loop_fp, r=flip1995
bors [Mon, 12 Apr 2021 09:45:32 +0000 (09:45 +0000)]
Auto merge of #6982 - Jarcho:explicit_into_iter_loop_fp, r=flip1995

Fix `explicit_into_iter_loop`

fixes: #6900

changelog: Only lint when `into_iter` is an implementation of `IntoIterator`

3 years agoAuto merge of #7047 - camsteffen:lang-ctor, r=flip1995
bors [Mon, 12 Apr 2021 08:52:10 +0000 (08:52 +0000)]
Auto merge of #7047 - camsteffen:lang-ctor, r=flip1995

Introduce `is_lang_ctor`

changelog: none

Replaces `is_some_ctor` and `is_ok_ctor`. Removes many path usages.

3 years agoAuto merge of #7065 - rail-rain:warn_copy_pass_by_ref, r=Manishearth
bors [Mon, 12 Apr 2021 04:38:42 +0000 (04:38 +0000)]
Auto merge of #7065 - rail-rain:warn_copy_pass_by_ref, r=Manishearth

Add a note on the issue #5953

Hello,

I thought it would be better to have a note and warning about this issue considering it introduced an UB in the past even with the "Search on Github" feature.

---

changelog: Add a note on the issue #5953 to the known problems section.

3 years agoAdd a note on the issue #5953
rail [Sat, 10 Apr 2021 05:50:54 +0000 (17:50 +1200)]
Add a note on the issue #5953

3 years agoAuto merge of #7059 - camsteffen:filter-map, r=flip1995
bors [Sun, 11 Apr 2021 18:24:23 +0000 (18:24 +0000)]
Auto merge of #7059 - camsteffen:filter-map, r=flip1995

Deprecate `filter_map`

Since #6591, `filter_map` does not even lint `filter().map()`. The cases that are still linted make no sense IMO. So this just removes/deprecates it.

changelog: Deprecate `filter_map` lint

Closes #3424
Fixes #7050

3 years agoAuto merge of #6905 - ThibsG:fpSingleComponentPathImports5210, r=giraffate
bors [Sun, 11 Apr 2021 14:18:38 +0000 (14:18 +0000)]
Auto merge of #6905 - ThibsG:fpSingleComponentPathImports5210, r=giraffate

Fix FP in `single_component_path_imports` lint

Fix FP in  `single_component_path_imports` lint when the import is reused with `self`, like in `use self::module`.

Fixes #5210

changelog: none

3 years agoFix FP in `wrong_self_convention` lint
ThibsG [Sun, 11 Apr 2021 11:29:08 +0000 (13:29 +0200)]
Fix FP in `wrong_self_convention` lint

3 years agoAuto merge of #7063 - daxpedda:debug-assert-panic, r=Manishearth
bors [Sat, 10 Apr 2021 22:14:06 +0000 (22:14 +0000)]
Auto merge of #7063 - daxpedda:debug-assert-panic, r=Manishearth

Fix false-positive `debug_assert` in `panic`

This fixes a false-positive in `clippy::panic` when `debug_assert` is used with a message.

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

changelog: Fix false-positive in `panic` when `debug_assert` is used with a message

3 years agoDeprecate filter_map
Cameron Steffen [Fri, 9 Apr 2021 21:25:39 +0000 (16:25 -0500)]
Deprecate filter_map

3 years agoFix false-positive `debug_assert` in `panic`
daxpedda [Sat, 10 Apr 2021 21:37:18 +0000 (23:37 +0200)]
Fix false-positive `debug_assert` in `panic`

3 years agoAuto merge of #7060 - daxpedda:debug-assert-panic-in-result-fn, r=flip1995
bors [Sat, 10 Apr 2021 19:15:37 +0000 (19:15 +0000)]
Auto merge of #7060 - daxpedda:debug-assert-panic-in-result-fn, r=flip1995

Remove `debug_assert` from `panic_in_result_fn`

I couldn't find any documentation on `debug_assert` that should be remove.
In my humble opinion, I would also like to argue that `todo` and `unreachable` shouldn't trigger this lint?

Related: https://github.com/rust-lang/rust-clippy/issues/6082

r? `@flip1995`

changelog: Change `panic_in_result_fn` to ignore `debug_assert` and co macros

3 years agoFix false-positive `debug_assert`
daxpedda [Sat, 10 Apr 2021 18:54:40 +0000 (20:54 +0200)]
Fix false-positive `debug_assert`

3 years agoFix rustfmt
daxpedda [Sat, 10 Apr 2021 15:45:55 +0000 (17:45 +0200)]
Fix rustfmt

3 years agoRemove `debug_assert` from `panic_in_result_fn`
daxpedda [Sat, 10 Apr 2021 15:38:04 +0000 (17:38 +0200)]
Remove `debug_assert` from `panic_in_result_fn`

3 years agoHandle imports which are nested directly
ThibsG [Sat, 10 Apr 2021 08:26:53 +0000 (10:26 +0200)]
Handle imports which are nested directly

3 years agoAuto merge of #7056 - jyn514:register-renamed, r=flip1995
bors [Fri, 9 Apr 2021 15:17:36 +0000 (15:17 +0000)]
Auto merge of #7056 - jyn514:register-renamed, r=flip1995

Use `register_renamed` instead of `register_removed` for uplifted lints

This still applies the lint, and also adds a structured suggestion to
rename it.

changelog: Use `register_renamed` instead of `register_removed` for lints uplifted to rustc

3 years agoUse `register_renamed` instead of `register_removed` for uplifted lints
Joshua Nelson [Fri, 9 Apr 2021 14:09:06 +0000 (10:09 -0400)]
Use `register_renamed` instead of `register_removed` for uplifted lints

This still applies the lint, and also adds a structured suggestion to
rename it.

3 years agoAuto merge of #7023 - boxdot:invalid-null-usage-v2, r=camsteffen
bors [Thu, 8 Apr 2021 21:00:48 +0000 (21:00 +0000)]
Auto merge of #7023 - boxdot:invalid-null-usage-v2, r=camsteffen

Invalid null usage v2

This is continuation of #6192 after inactivity.

I plan to move paths into the compiler as diagnostic items after this is merged.

fixes #1703
changelog: none

3 years agoAdd invalid null pointer usage lint.
boxdot [Sun, 18 Oct 2020 11:42:09 +0000 (13:42 +0200)]
Add invalid null pointer usage lint.

3 years agoAuto merge of #7022 - Jarcho:macro_use_import_ice, r=flip1995
bors [Thu, 8 Apr 2021 16:04:55 +0000 (16:04 +0000)]
Auto merge of #7022 - Jarcho:macro_use_import_ice, r=flip1995

Fix `macro_use_import` ICE

fixes: #7015
changelog: Fix `macro_use_import` ICE

3 years agoAuto merge of #7051 - flip1995:rustup, r=flip1995
bors [Thu, 8 Apr 2021 15:46:38 +0000 (15:46 +0000)]
Auto merge of #7051 - flip1995:rustup, r=flip1995

Rustup

changelog: none

r? `@ghost`

3 years agoBump nightly version -> 2021-04-08
flip1995 [Thu, 8 Apr 2021 15:37:06 +0000 (17:37 +0200)]
Bump nightly version -> 2021-04-08

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 8 Apr 2021 15:18:19 +0000 (17:18 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoRollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov
Dylan DPC [Wed, 7 Apr 2021 11:07:14 +0000 (13:07 +0200)]
Rollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov

Use AnonConst for asm! constants

This replaces the old system which used explicit promotion. See #83169 for more background.

The syntax for `const` operands is still the same as before: `const <expr>`.

Fixes #83169

Because the implementation is heavily based on inline consts, we suffer from the same issues:
- We lose the ability to use expressions derived from generics. See the deleted tests in `src/test/ui/asm/const.rs`.
- We are hitting the same ICEs as inline consts, for example #78174. It is unlikely that we will be able to stabilize this before inline consts are stabilized.

3 years agoAuto merge of #7046 - camsteffen:symbol-optimize, r=giraffate
bors [Wed, 7 Apr 2021 04:36:31 +0000 (04:36 +0000)]
Auto merge of #7046 - camsteffen:symbol-optimize, r=giraffate

Some symbol optimizations

changelog: none

3 years agoIntroduce is_lang_ctor
Cameron Steffen [Fri, 2 Apr 2021 22:09:58 +0000 (17:09 -0500)]
Introduce is_lang_ctor

3 years agoSymbol optimizations
Cameron Steffen [Wed, 24 Mar 2021 14:31:43 +0000 (09:31 -0500)]
Symbol optimizations

3 years agoAuto merge of #7044 - camsteffen:match-path, r=Manishearth
bors [Tue, 6 Apr 2021 17:41:34 +0000 (17:41 +0000)]
Auto merge of #7044 - camsteffen:match-path, r=Manishearth

Soft deprecate match_path and match_qpath

changelog: none

From zulip [disucssion](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/match_.5Bq.5Dpath.20is.20bad.3F).

3 years agoAuto merge of #7043 - camsteffen:dead-utils, r=flip1995
bors [Tue, 6 Apr 2021 16:49:42 +0000 (16:49 +0000)]
Auto merge of #7043 - camsteffen:dead-utils, r=flip1995

Remove some dead utils

changelog: none

3 years agoSoft deprecate match_path and match_qpath
Cameron Steffen [Tue, 6 Apr 2021 13:56:14 +0000 (08:56 -0500)]
Soft deprecate match_path and match_qpath

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 agoFix `explicit_into_iter_loop`
Jason Newcomb [Sat, 27 Mar 2021 02:28:59 +0000 (22:28 -0400)]
Fix `explicit_into_iter_loop`
Only lint when `into_iter` is an implementation of `IntoIterator`
Minor cleanups

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 agoUse AnonConst for asm! constants
Amanieu d'Antras [Tue, 6 Apr 2021 04:50:55 +0000 (05:50 +0100)]
Use AnonConst for asm! constants

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 agoRollup merge of #83820 - petrochenkov:nolinkargs, r=nagisa
Dylan DPC [Sun, 4 Apr 2021 22:24:33 +0000 (00:24 +0200)]
Rollup merge of #83820 - petrochenkov:nolinkargs, r=nagisa

Remove attribute `#[link_args]`

Closes https://github.com/rust-lang/rust/issues/29596

The attribute could always be replaced with `-C link-arg`, but cargo didn't provide a reasonable way to pass such flags to rustc.
Now cargo supports `cargo:rustc-link-arg*` directives in build scripts (https://doc.rust-lang.org/cargo/reference/unstable.html#extra-link-arg), so this attribute can be removed.

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 agoCheck path imports per module
ThibsG [Sun, 4 Apr 2021 12:21:02 +0000 (14:21 +0200)]
Check path imports per module

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 agoRemove attribute `#[link_args]`
Vadim Petrochenkov [Sat, 3 Apr 2021 17:20:18 +0000 (20:20 +0300)]
Remove attribute `#[link_args]`

3 years agoFix `macro_use_import` ICE
Jason Newcomb [Sat, 3 Apr 2021 02:24:52 +0000 (22:24 -0400)]
Fix `macro_use_import` ICE

3 years agofix clippy error
Roxane [Tue, 30 Mar 2021 04:30:20 +0000 (00:30 -0400)]
fix clippy error

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.