From ede86797bd8249db720fc61a0c6b9d94c0bd9052 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 18 Sep 2021 17:37:24 -0400 Subject: [PATCH 1/2] Enable 2021 compatibility lints for all in-tree code This just applies the suggested fixes from the compatibility warnings, leaving any that are in practice spurious in. This is primarily intended to provide a starting point to identify possible fixes to the migrations (e.g., by avoiding spurious warnings). A secondary commit cleans these up where they are false positives (as is true in many of the cases). --- clippy_utils/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 3a94f472983..5c505f6851a 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -990,7 +990,10 @@ pub fn can_move_expr_to_closure(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> captures: HirIdMap::default(), }; v.visit_expr(expr); - v.allow_closure.then(|| v.captures) + v.allow_closure.then(|| { + let _ = &v; + v.captures + }) } /// Returns the method names and argument list of nested method call expressions that make up From 1183371af17fb67317a9d860d3028db500a14ba7 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 19 Sep 2021 13:46:05 -0400 Subject: [PATCH 2/2] Remove Drop-caused migration-added captures All of these were added due to insignificant Drop types being present. --- clippy_utils/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 5c505f6851a..3a94f472983 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -990,10 +990,7 @@ pub fn can_move_expr_to_closure(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> captures: HirIdMap::default(), }; v.visit_expr(expr); - v.allow_closure.then(|| { - let _ = &v; - v.captures - }) + v.allow_closure.then(|| v.captures) } /// Returns the method names and argument list of nested method call expressions that make up