Commit Graph

11418 Commits

Author SHA1 Message Date
bors
8f3c2450c2 Auto merge of #7074 - camsteffen:diag-methods, r=llogiq
Split `is_diagnostic_assoc_item`

changelog: none

* Split `is_diagnostic_assoc_item` into `is_diag_item_method` and `is_diag_trait_item`
  * `is_diag_item_method` is a bit more nuanced with the `tcx.type_of(impl_id).ty_adt_def()` step, so it seems better to keep that separate.
  * No need to generalize over traits and Adt's since we know which one we want at compile time
  * "item" vs. "method" because a trait may have associated items.
* Replaces the usage of the `sym::slice` diagnostic item with the `slice_alloc` lang item. The diagnostic item should be removed from rustc because it is on the `slice_alloc` impl, not slice itself (and it's not needed).
2021-04-13 20:31:22 +00:00
Cameron Steffen
76bd5d232c Refactor diagnostic item methods 2021-04-13 14:10:40 -05:00
bors
e9728b80ce Auto merge of #7068 - boxdot:remove-std-ptr-null, r=camsteffen
Remove paths::STD_PTR_NULL

Related to #5393

changelog: none
2021-04-12 18:37:31 +00:00
bors
2a96bc434b 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`
2021-04-12 18:00:38 +00:00
boxdot
d6beb18411
Remove paths::STD_PTR_NULL 2021-04-12 18:35:47 +02:00
bors
411c0df1d0 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
2021-04-12 14:16:17 +00:00
Takayuki
e6c67ad2bf fix limit_stderr_length error 2021-04-12 21:58:34 +09:00
Takayuki
0218a3b12f add tests for a false negative on needless_return 2021-04-12 21:37:19 +09:00
Takayuki
53260df2fa fix a false negative on needless_return 2021-04-12 21:36:49 +09:00
bors
c3ef585328 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`
2021-04-12 09:45:32 +00:00
bors
aecccbc579 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.
2021-04-12 08:52:10 +00:00
bors
f0ceb28ba1 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.
2021-04-12 04:38:42 +00:00
rail
fb54b703c7 Add a note on the issue #5953 2021-04-12 15:32:54 +12:00
bors
a6b514c603 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
2021-04-11 18:24:23 +00:00
bors
67fad0139f 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
2021-04-11 14:18:38 +00:00
ThibsG
3ce6f0d022 Fix FP in wrong_self_convention lint 2021-04-11 13:29:08 +02:00
bors
75e20ba6a2 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
2021-04-10 22:14:06 +00:00
Cameron Steffen
a45faf66f3 Deprecate filter_map 2021-04-10 16:59:59 -05:00
daxpedda
cb14e7ebf4
Fix false-positive debug_assert in panic 2021-04-10 23:37:18 +02:00
bors
fd5cf4e82d 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
2021-04-10 19:15:37 +00:00
daxpedda
271c163ba3
Fix false-positive debug_assert 2021-04-10 20:54:40 +02:00
daxpedda
8f4417faf2
Fix rustfmt 2021-04-10 17:45:55 +02:00
daxpedda
43e6c656ba
Remove debug_assert from panic_in_result_fn 2021-04-10 17:38:04 +02:00
ThibsG
297e84f3f4 Handle imports which are nested directly 2021-04-10 10:26:53 +02:00
bors
f7c2c44e76 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
2021-04-09 15:17:36 +00:00
Joshua Nelson
012f9d47b2 Use register_renamed instead of register_removed for uplifted lints
This still applies the lint, and also adds a structured suggestion to
rename it.
2021-04-09 10:56:11 -04:00
bors
75efc144e7 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
2021-04-08 21:00:48 +00:00
boxdot
4f7fc11ef1
Add invalid null pointer usage lint. 2021-04-08 22:49:48 +02:00
bors
c40fa00113 Auto merge of #7022 - Jarcho:macro_use_import_ice, r=flip1995
Fix `macro_use_import` ICE

fixes: #7015
changelog: Fix `macro_use_import` ICE
2021-04-08 16:04:55 +00:00
bors
b40ea209e7 Auto merge of #7051 - flip1995:rustup, r=flip1995
Rustup

changelog: none

r? `@ghost`
2021-04-08 15:46:38 +00:00
flip1995
61eafbb1e0
Bump nightly version -> 2021-04-08 2021-04-08 17:37:06 +02:00
flip1995
ffa2b7da29
Merge remote-tracking branch 'upstream/master' into rustup 2021-04-08 17:36:41 +02:00
Dylan DPC
cde58f7174 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.
2021-04-07 13:07:14 +02:00
bors
db6ea84f87 Auto merge of #7046 - camsteffen:symbol-optimize, r=giraffate
Some symbol optimizations

changelog: none
2021-04-07 04:36:31 +00:00
Cameron Steffen
7468542328 Introduce is_lang_ctor 2021-04-06 15:05:00 -05:00
Cameron Steffen
47f0c15f67 Symbol optimizations 2021-04-06 13:00:36 -05:00
bors
624e8aad32 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).
2021-04-06 17:41:34 +00:00
bors
bbe1567bc9 Auto merge of #7043 - camsteffen:dead-utils, r=flip1995
Remove some dead utils

changelog: none
2021-04-06 16:49:42 +00:00
Cameron Steffen
a342de3bcb Soft deprecate match_path and match_qpath 2021-04-06 11:46:27 -05:00
Cameron Steffen
79d3082cd7 Remove paths::PATH_BUF 2021-04-06 11:33:59 -05:00
Cameron Steffen
1efb551369 Remove get_node_span 2021-04-06 11:33:59 -05:00
Jason Newcomb
6b5778eb17
Fix explicit_into_iter_loop
Only lint when `into_iter` is an implementation of `IntoIterator`
Minor cleanups
2021-04-06 12:12:32 -04:00
bors
6ae0835df0 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
2021-04-06 15:30:48 +00:00
Jason Newcomb
12fce55766
Fix all occurences of needless_borrow internally 2021-04-06 10:43:47 -04:00
bors
d2ba777159 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.
2021-04-06 13:38:08 +00:00
Amanieu d'Antras
879bfeca54 Use AnonConst for asm! constants 2021-04-06 12:35:41 +01:00
Horaci Macias
8a50923da4 consider mutability on useless_vec suggestions
https://github.com/rust-lang/rust-clippy/issues/7035
2021-04-06 11:09:52 +02:00
bors
57406c93df 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
2021-04-05 22:57:33 +00:00
bors
25c1ed38aa 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`
2021-04-05 19:14:55 +00:00
bors
d91da405df 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
2021-04-05 19:00:41 +00:00