Commit Graph

11391 Commits

Author SHA1 Message Date
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
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
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
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
bors
1a45e437b8 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.
2021-04-05 18:02:32 +00:00
xFrednet
a6f54f5dfd Renaming the lint to branches_sharing_code and fixing typos 2021-04-05 13:35:51 +02:00
xFrednet
7c9e192e05 Test for empty blocks and update from master 2021-04-05 13:35:51 +02:00
xFrednet
8c0b4d7f65 Only running shared_code_in_if_blocks only for if statements 2021-04-05 13:35:51 +02:00
xFrednet
617c65baa9 Moving shared_code_in_if_blocks to clippy::complexity and running lintcheck 2021-04-05 13:35:51 +02:00
xFrednet
c74e49eab9 Adapted the lint to use the new SpanlessEq 2021-04-05 13:35:51 +02:00
xFrednet
65ed5a632f Updated code for dogfood 2021-04-05 13:33:45 +02:00
xFrednet
b1d26e544f Improved shared_code_in_if_blocks message and added test stderrs 2021-04-05 13:33:45 +02:00
xFrednet
8efc6acc05 Improved shared_code_in_if_blocks output readability and added tests 2021-04-05 13:33:45 +02:00
xFrednet
469ff96db3 The shared_code_in_if_blocks lint only operats on entire if expr not else ifs 2021-04-05 13:33:45 +02:00
xFrednet
d1df73228a 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
2021-04-05 13:33:45 +02:00
xFrednet
232e2b79f2 Added documentation to the multispan_sugg method 2021-04-05 13:33:45 +02:00
bors
81f99460b1 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
2021-04-05 09:27:18 +00:00
bors
8d221c569e Auto merge of #7027 - camsteffen:defidmap, r=phansch
Use DefIdMap and similar aliases

changelog: none
2021-04-05 09:15:08 +00:00
bors
e315437bd6 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`
2021-04-05 07:45:05 +00:00
Aliénore Bouttefeux
8e5dd4b2e9 add test for missing_panic_doc on assert_eq/assert_ne 2021-04-05 09:16:48 +02:00
Jason Newcomb
a00de90ceb
Fix ICE in missing_panics_doc 2021-04-05 00:09:13 -04:00
bors
a15d987c8f Auto merge of #7021 - camsteffen:7012, r=giraffate
Fix ICE #7012

changelog: none

Fixes #7012
2021-04-04 23:51:31 +00:00
Dylan DPC
44e3ccb6dc 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.
2021-04-05 00:24:33 +02:00
xFrednet
da04e873b3 Quick fix to access the correct css files 2021-04-04 20:15:41 +02:00
bors
6bb608c00c 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
2021-04-04 16:59:14 +00:00
xFrednet
e25b1060f5 Adding a dark theme to the clippy lint list 2021-04-04 15:36:30 +02:00
Aliénore Bouttefeux
2f81e4e34f modification not working: fixing 2021-04-04 13:03:05 +02:00
Aliénore Bouttefeux
984ab98712 added core::panicking::assert_failed_inner as panicking 2021-04-04 11:56:45 +02:00