Skip to content

Commit 67100f6

Browse files
committed
Auto merge of #73660 - flip1995:clippyup, r=nikomatsakis
Update Clippy
2 parents d8ed1b0 + a2c0499 commit 67100f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1077
-293
lines changed

src/tools/clippy/.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
name: Blank Issue
3+
about: Create a blank issue.
4+
---
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: Bug Report
3+
about: Create a bug report for Clippy
4+
labels: L-bug
5+
---
6+
<!--
7+
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
8+
along with any information you feel relevant to replicating the bug.
9+
-->
10+
11+
I tried this code:
12+
13+
```rust
14+
<code>
15+
```
16+
17+
I expected to see this happen: *explanation*
18+
19+
Instead, this happened: *explanation*
20+
21+
### Meta
22+
23+
- `cargo clippy -V`: e.g. clippy 0.0.212 (f455e46 2020-06-20)
24+
- `rustc -Vv`:
25+
```
26+
rustc 1.46.0-nightly (f455e46ea 2020-06-20)
27+
binary: rustc
28+
commit-hash: f455e46eae1a227d735091091144601b467e1565
29+
commit-date: 2020-06-20
30+
host: x86_64-unknown-linux-gnu
31+
release: 1.46.0-nightly
32+
LLVM version: 10.0
33+
```
34+
35+
<!--
36+
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
37+
environment. E.g. `RUST_BACKTRACE=1 cargo clippy`.
38+
-->
39+
<details><summary>Backtrace</summary>
40+
<p>
41+
42+
```
43+
<backtrace>
44+
```
45+
46+
</p>
47+
</details>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: Rust Programming Language Forum
4+
url: https://users.rust-lang.org
5+
about: Please ask and answer questions about Rust here.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: Internal Compiler Error
3+
about: Create a report for an internal compiler error in Clippy.
4+
labels: L-bug, L-crash
5+
---
6+
<!--
7+
Thank you for finding an Internal Compiler Error! 🧊 If possible, try to provide
8+
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
9+
how to create smaller examples.
10+
11+
http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
12+
13+
-->
14+
15+
### Code
16+
17+
```rust
18+
<code>
19+
```
20+
21+
### Meta
22+
23+
- `cargo clippy -V`: e.g. clippy 0.0.212 (f455e46 2020-06-20)
24+
- `rustc -Vv`:
25+
```
26+
rustc 1.46.0-nightly (f455e46ea 2020-06-20)
27+
binary: rustc
28+
commit-hash: f455e46eae1a227d735091091144601b467e1565
29+
commit-date: 2020-06-20
30+
host: x86_64-unknown-linux-gnu
31+
release: 1.46.0-nightly
32+
LLVM version: 10.0
33+
```
34+
35+
### Error output
36+
37+
```
38+
<output>
39+
```
40+
41+
<!--
42+
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
43+
environment. E.g. `RUST_BACKTRACE=1 cargo clippy`.
44+
-->
45+
<details><summary>Backtrace</summary>
46+
<p>
47+
48+
```
49+
<backtrace>
50+
```
51+
52+
</p>
53+
</details>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: New lint suggestion
3+
about: Suggest a new Clippy lint.
4+
labels: L-lint
5+
---
6+
7+
### What it does
8+
9+
*What does this lint do?*
10+
11+
### Categories (optional)
12+
13+
- Kind: *See <https://github.com/rust-lang/rust-clippy/blob/master/README.md#clippy> for list of lint kinds*
14+
15+
*What benefit of this lint over old code?*
16+
17+
For example:
18+
- Remove bounce checking inserted by ...
19+
- Remove the need to duplicating/storing/typo ...
20+
21+
### Drawbacks
22+
23+
None.
24+
25+
### Example
26+
27+
```rust
28+
<code>
29+
```
30+
31+
Could be written as:
32+
33+
```rust
34+
<code>
35+
```

src/tools/clippy/.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ Delete this line and everything above before opening your PR.
2828

2929
---
3030

31+
*Please keep the line below*
3132
changelog: none

src/tools/clippy/.github/driver.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,16 @@ unset CARGO_MANIFEST_DIR
2626
sed -e "s,tests/ui,\$DIR," -e "/= help/d" cstring.stderr > normalized.stderr
2727
diff normalized.stderr tests/ui/cstring.stderr
2828

29+
30+
# make sure "clippy-driver --rustc --arg" and "rustc --arg" behave the same
31+
SYSROOT=`rustc --print sysroot`
32+
diff <(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver --rustc --version --verbose) <(rustc --version --verbose)
33+
34+
35+
echo "fn main() {}" > target/driver_test.rs
36+
# we can't run 2 rustcs on the same file at the same time
37+
CLIPPY=`LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver ./target/driver_test.rs --rustc`
38+
RUSTC=`rustc ./target/driver_test.rs`
39+
diff <($CLIPPY) <($RUSTC)
40+
2941
# TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR

src/tools/clippy/clippy_lints/src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
396396
let l = self.expr(left)?;
397397
let r = self.expr(right);
398398
match (l, r) {
399-
(Constant::Int(l), Some(Constant::Int(r))) => match self.tables.expr_ty(left).kind {
399+
(Constant::Int(l), Some(Constant::Int(r))) => match self.tables.expr_ty_opt(left)?.kind {
400400
ty::Int(ity) => {
401401
let l = sext(self.lcx.tcx, l, ity);
402402
let r = sext(self.lcx.tcx, r, ity);

src/tools/clippy/clippy_lints/src/escape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_middle::ty::{self, Ty};
66
use rustc_session::{declare_tool_lint, impl_lint_pass};
77
use rustc_span::source_map::Span;
88
use rustc_target::abi::LayoutOf;
9-
use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, PlaceWithHirId, PlaceBase};
9+
use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, PlaceBase, PlaceWithHirId};
1010

1111
use crate::utils::span_lint;
1212

0 commit comments

Comments
 (0)