Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Clippy #84980

Merged
merged 93 commits into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
65778fa
fix a false-positive inside const fn in comparison_chain
TaKO8Ki Apr 22, 2021
02bf692
Merge commit '98e2b9f25b6db4b2680a3d388456d9f95cb28344' into clippyup
flip1995 Apr 22, 2021
22f8c13
Improve `implicit_return`
Jarcho Apr 2, 2021
74cf5f2
Fix `implicit_return` suggestion for async functions
Jarcho Apr 2, 2021
ef9ad80
Add examples to better explain `walk_span_to_context`
Jarcho Apr 14, 2021
3d793f3
Minor cleanup of `implicit_return`
Jarcho Apr 22, 2021
f801d02
fix clippy
RalfJung Apr 25, 2021
ae72f1a
Merge commit '7c7683c8efe447b251d6c5ca6cce51233060f6e8' into clippyup
flip1995 Apr 27, 2021
af0dde2
Implement `x.py test src/tools/clippy --bless`
jyn514 Apr 14, 2021
f4bd12c
Switch `rustc::internal` from deny to warn
jyn514 Apr 27, 2021
572c405
fix ice when checking rustc libstd
matthiaskrgr Apr 27, 2021
ce37099
Auto merge of #7140 - matthiaskrgr:ice_std, r=llogiq
bors Apr 27, 2021
32351d6
Remove leftover plugin conf_file code
camsteffen Apr 28, 2021
2f49455
Implement RFC 1260 with feature_name `imported_main`.
crlf0710 Apr 25, 2021
cd88031
Rollup merge of #84484 - jyn514:check-tools, r=Mark-Simulacrum
jackh726 Apr 29, 2021
63425de
while_immutable_cond: check condition for mutation
llogiq Apr 29, 2021
bbd81f2
Auto merge of #84189 - jyn514:clippy-dev, r=Mark-Simulacrum
bors Apr 29, 2021
a55912c
Auto merge of #7141 - camsteffen:conf-file, r=flip1995
bors Apr 29, 2021
6ddd3c9
Fix clippy error
rylev Apr 29, 2021
0dff377
use `in_constant`
TaKO8Ki Apr 30, 2021
14f1551
Auto merge of #7118 - TaKO8Ki:fix-false-positive-in-comparison-chain,…
bors Apr 30, 2021
5491c80
Auto merge of #84401 - crlf0710:impl_main_by_path, r=petrochenkov
bors Apr 30, 2021
5e49c4b
Auto merge of #6951 - Jarcho:implicit_return_fp, r=flip1995
bors Apr 30, 2021
a300b0e
Auto merge of #7144 - rust-lang:while_immutable_mut_cond, r=flip1995
bors Apr 30, 2021
a7dc1ca
Small fix in CONTRIBUTING.md
mgacek8 Apr 30, 2021
841244d
Auto merge of #7146 - mgacek8:mgacek8-small-fix, r=flip1995
bors Apr 30, 2021
b9c8e68
Disable default_trait_access in macros
camsteffen Apr 28, 2021
1e22e56
Refactor config deserialization
camsteffen Apr 28, 2021
b753540
Add ErrorKind::OutOfMemory
kornelski Apr 30, 2021
019dfb9
Auto merge of #7150 - camsteffen:better-conf, r=llogiq
bors May 2, 2021
857d9f1
Fix error punctuation
camsteffen May 2, 2021
4998130
Fix config parsing
camsteffen May 2, 2021
ffb0951
Update config contributing docs
camsteffen May 2, 2021
f41f380
Auto merge of #7154 - camsteffen:better-conf, r=flip1995
bors May 3, 2021
c080899
add strip_{prefix,suffix} to PATTERN_METHODS
hellow554 May 3, 2021
19e7448
move PATTERN_METHODS table directly into file
hellow554 May 3, 2021
5e3160c
Auto merge of #7156 - hellow554:single_char_strip, r=flip1995
bors May 3, 2021
ee6d1a3
Change `std::sys::unix::ext::fs::PermissionsExt::from_mode` to `std::…
CDirkx Apr 25, 2021
91a8611
move misc_early to misc_early/mod.rs
TaKO8Ki May 4, 2021
64eb18e
move builtin_type_shadow to its own module
TaKO8Ki May 4, 2021
9735470
Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakis
bors May 4, 2021
55af0ce
move double_neg to its own module
TaKO8Ki May 4, 2021
52cfde0
move redundant_pattern to its own module
TaKO8Ki May 4, 2021
c0a106e
move unneeded_wildcard_pattern to its own module
TaKO8Ki May 4, 2021
1c3c54a
SpanlessHash Pat
camsteffen May 4, 2021
a8f28b6
Auto merge of #7157 - camsteffen:hash-pat, r=flip1995
bors May 4, 2021
829fde5
move unneeded_field_pattern to its own module
TaKO8Ki May 4, 2021
f012e0e
move unseparated_literal_suffix to its own module
TaKO8Ki May 4, 2021
0773d8a
move mixed_case_hex_literals to its own module
TaKO8Ki May 4, 2021
b1faaae
needless_collect: Lint cases with type annotations
mgacek8 May 3, 2021
0dc38c0
Fix copy_iterator uitest
mgacek8 May 4, 2021
1835d8a
needless_collect: Add `BinaryHeap` for indirect usage lint
mgacek8 May 4, 2021
b1567f4
move zero_prefixed_literal to its own module
TaKO8Ki May 4, 2021
2dfb246
refactor unseparated_literal_suffix
TaKO8Ki May 4, 2021
3fbb060
replace lit_snip type with &str
TaKO8Ki May 4, 2021
83329ec
Fix unused_unit macro false positive
camsteffen May 4, 2021
7e538e3
Auto merge of #7167 - camsteffen:unused-unit-macro, r=flip1995
bors May 5, 2021
f79a2a3
needless_collect: use `node_type_opt` instead of `node_type`
mgacek8 May 5, 2021
344f04b
Fix stack overflow in `redundant_pattern_matching`
camsteffen May 5, 2021
59874f3
Add regression test for stack overflow in redundant_pattern_matching
flip1995 May 5, 2021
45d4e61
Auto merge of #84200 - CDirkx:os, r=m-ou-se
bors May 5, 2021
0baf6bf
Auto merge of #7163 - mgacek8:issue7110_needless_collect_with_type_an…
bors May 5, 2021
637751f
Metadata collection lint: Basic lint collection
xFrednet Jan 31, 2021
060e0e9
Metadata collection lint: Basic applicability collection
xFrednet Feb 14, 2021
68d702f
Metadata collection lint: Start Applicability value tracking
xFrednet Feb 17, 2021
8dca1b8
Metadata collection: Collecting Applicability assign values
xFrednet Feb 18, 2021
ee130d0
Metadata collection: Tracking Applicability mut borrows
xFrednet Feb 19, 2021
a39912c
Metadata collection: Some refactoring for readability
xFrednet Feb 20, 2021
ee8a99a
Metadata collection: Collecting Applicability assign values
xFrednet Feb 20, 2021
5830fa7
Metadata Collection: Collecting direct emission applicabilities (324/…
xFrednet Feb 27, 2021
6658db1
Metadata collection: processing emission closures (417/455)
xFrednet Feb 28, 2021
2ce5e36
Metadata collection: Refining the implementation
xFrednet Mar 1, 2021
35844d0
Metadata collection: Resolve lint from locals
xFrednet Mar 6, 2021
4fc9603
Metadata collection: Rounding up the implementation
xFrednet Mar 10, 2021
c1fa110
ENABLE_METADATA_COLLECTION env-value to disable default metadata coll…
xFrednet Mar 12, 2021
62cafe2
Applying PR suggestions
xFrednet Mar 12, 2021
e0eb29c
Applying PR suggestions (mostly typos)
xFrednet Mar 31, 2021
f35345d
Auto merge of #6887 - xFrednet:4310-internal-metadata-extraction-lint…
bors May 5, 2021
182a185
Auto merge of #7170 - flip1995:revert_drop_order, r=llogiq
bors May 5, 2021
2b38399
Improve eval_order_dependence output
camsteffen May 5, 2021
7a7b8bd
Fix eval_order_dependence async false positive
camsteffen May 5, 2021
93fe356
Auto merge of #7174 - camsteffen:eval-order-async, r=flip1995
bors May 5, 2021
d66d373
Fix unnecessary_filter_map false positive
camsteffen May 5, 2021
9dd8705
Auto merge of #7175 - camsteffen:filter-map-none, r=Manishearth
bors May 5, 2021
b8046fa
Add a missing lint to MSRV config doc
giraffate May 6, 2021
7191675
Auto merge of #7166 - TaKO8Ki:refactor_misc_early_module, r=llogiq
bors May 6, 2021
796a6f0
Auto merge of #7177 - giraffate:add_a_missing_lint_to_msrv_config_doc…
bors May 6, 2021
767cc7c
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 May 6, 2021
d52316d
Bump nightly version -> 2021-05-06
flip1995 May 6, 2021
d481b38
Bump Clippy version -> 0.1.54
flip1995 May 6, 2021
b71f340
Auto merge of #7178 - flip1995:rustup, r=flip1995
bors May 6, 2021
8e6ff8f
Merge commit 'b71f3405606d49b9735606b479c3415a0ca9810f' into clippyup
flip1995 May 6, 2021
c24058b
Update Cargo.lock
flip1995 May 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ dependencies = [

[[package]]
name = "clippy"
version = "0.1.53"
version = "0.1.54"
dependencies = [
"cargo_metadata 0.12.0",
"clippy-mini-macro-test",
Expand Down Expand Up @@ -585,7 +585,7 @@ dependencies = [

[[package]]
name = "clippy_lints"
version = "0.1.53"
version = "0.1.54"
dependencies = [
"cargo_metadata 0.12.0",
"clippy_utils",
Expand All @@ -597,14 +597,15 @@ dependencies = [
"rustc-semver",
"semver 0.11.0",
"serde",
"serde_json",
"toml",
"unicode-normalization",
"url 2.1.1",
]

[[package]]
name = "clippy_utils"
version = "0.1.53"
version = "0.1.54"
dependencies = [
"if_chain",
"itertools 0.9.0",
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ out

# gh pages docs
util/gh-pages/lints.json
**/metadata_collection.json

# rustfmt backups
*.rs.bk
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ which `IntelliJ Rust` will be able to understand.
Run `cargo dev ide_setup --repo-path <repo-path>` where `<repo-path>` is a path to the rustc repo
you just cloned.
The command will add path-dependencies pointing towards rustc-crates inside the rustc repo to
Clippys `Cargo.toml`s and should allow rust-analyzer to understand most of the types that Clippy uses.
Clippys `Cargo.toml`s and should allow `IntelliJ Rust` to understand most of the types that Clippy uses.
Just make sure to remove the dependencies again before finally making a pull request!

[rustc_repo]: https://github.com/rust-lang/rust/
Expand Down
3 changes: 2 additions & 1 deletion src/tools/clippy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.1.53"
version = "0.1.54"
authors = ["The Rust Clippy Developers"]
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
Expand Down Expand Up @@ -52,6 +52,7 @@ rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util" }
deny-warnings = []
integration = ["tempfile"]
internal-lints = ["clippy_lints/internal-lints"]
metadata-collector-lint = ["internal-lints", "clippy_lints/metadata-collector-lint"]

[package.metadata.rust-analyzer]
# This package uses #[feature(rustc_private)]
Expand Down
4 changes: 3 additions & 1 deletion src/tools/clippy/clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "clippy_lints"
# begin automatic update
version = "0.1.53"
version = "0.1.54"
# end automatic update
authors = ["The Rust Clippy Developers"]
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
Expand All @@ -20,6 +20,7 @@ pulldown-cmark = { version = "0.8", default-features = false }
quine-mc_cluskey = "0.2.2"
regex-syntax = "0.6"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", optional = true }
toml = "0.5.3"
unicode-normalization = "0.1"
semver = "0.11"
Expand All @@ -32,6 +33,7 @@ url = { version = "2.1.0", features = ["serde"] }
deny-warnings = []
# build clippy with internal lints enabled, off by default
internal-lints = ["clippy_utils/internal-lints"]
metadata-collector-lint = ["serde_json", "clippy_utils/metadata-collector-lint"]

[package.metadata.rust-analyzer]
# This crate uses #[feature(rustc_private)]
Expand Down
6 changes: 5 additions & 1 deletion src/tools/clippy/clippy_lints/src/comparison_chain.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::ty::implements_trait;
use clippy_utils::{get_trait_def_id, if_sequence, is_else_clause, paths, SpanlessEq};
use clippy_utils::{get_trait_def_id, if_sequence, in_constant, is_else_clause, paths, SpanlessEq};
use rustc_hir::{BinOpKind, Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
Expand Down Expand Up @@ -64,6 +64,10 @@ impl<'tcx> LateLintPass<'tcx> for ComparisonChain {
return;
}

if in_constant(cx, expr.hir_id) {
return;
}

// Check that there exists at least one explicit else condition
let (conds, _) = if_sequence(expr);
if conds.len() < 2 {
Expand Down
3 changes: 2 additions & 1 deletion src/tools/clippy/clippy_lints/src/default.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use clippy_utils::diagnostics::{span_lint_and_note, span_lint_and_sugg};
use clippy_utils::source::snippet_with_macro_callsite;
use clippy_utils::{any_parent_is_automatically_derived, contains_name, match_def_path, paths};
use clippy_utils::{any_parent_is_automatically_derived, contains_name, in_macro, match_def_path, paths};
use if_chain::if_chain;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::Applicability;
Expand Down Expand Up @@ -75,6 +75,7 @@ impl_lint_pass!(Default => [DEFAULT_TRAIT_ACCESS, FIELD_REASSIGN_WITH_DEFAULT]);
impl LateLintPass<'_> for Default {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
if_chain! {
if !in_macro(expr.span);
// Avoid cases already linted by `field_reassign_with_default`
if !self.reassigned_linted.contains(&expr.span);
if let ExprKind::Call(path, ..) = expr.kind;
Expand Down
30 changes: 15 additions & 15 deletions src/tools/clippy/clippy_lints/src/eval_order_dependence.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use clippy_utils::diagnostics::{span_lint, span_lint_and_note};
use clippy_utils::{get_parent_expr, path_to_local, path_to_local_id};
use if_chain::if_chain;
use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc_hir::{BinOpKind, Block, Expr, ExprKind, Guard, HirId, Local, Node, Stmt, StmtKind};
use rustc_lint::{LateContext, LateLintPass};
Expand Down Expand Up @@ -70,20 +71,19 @@ declare_lint_pass!(EvalOrderDependence => [EVAL_ORDER_DEPENDENCE, DIVERGING_SUB_
impl<'tcx> LateLintPass<'tcx> for EvalOrderDependence {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
// Find a write to a local variable.
match expr.kind {
ExprKind::Assign(lhs, ..) | ExprKind::AssignOp(_, lhs, _) => {
if let Some(var) = path_to_local(lhs) {
let mut visitor = ReadVisitor {
cx,
var,
write_expr: expr,
last_expr: expr,
};
check_for_unsequenced_reads(&mut visitor);
}
},
_ => {},
}
let var = if_chain! {
if let ExprKind::Assign(lhs, ..) | ExprKind::AssignOp(_, lhs, _) = expr.kind;
if let Some(var) = path_to_local(lhs);
if expr.span.desugaring_kind().is_none();
then { var } else { return; }
};
let mut visitor = ReadVisitor {
cx,
var,
write_expr: expr,
last_expr: expr,
};
check_for_unsequenced_reads(&mut visitor);
}
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) {
match stmt.kind {
Expand Down Expand Up @@ -305,7 +305,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ReadVisitor<'a, 'tcx> {
self.cx,
EVAL_ORDER_DEPENDENCE,
expr.span,
"unsequenced read of a variable",
&format!("unsequenced read of `{}`", self.cx.tcx.hir().name(self.var)),
Some(self.write_expr.span),
"whether read occurs before this write depends on evaluation order",
);
Expand Down
Loading