about summary refs log tree commit diff
path: root/clippy_utils/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-06 09:20:55 +0000
committerbors <bors@rust-lang.org>2022-07-06 09:20:55 +0000
commitf93d418f1789a5782053e99038db7d6701c8a30c (patch)
treeac44f8a63130bdd24bb3716f284b731ca5010e48 /clippy_utils/src
parentfd605ab7e45570eeaab7ca4ed47bcdd4555064b6 (diff)
parentb7230d4f44e974c6639980a2e44e8d7523b6c90c (diff)
downloadrust-f93d418f1789a5782053e99038db7d6701c8a30c.tar.gz
rust-f93d418f1789a5782053e99038db7d6701c8a30c.zip
Auto merge of #9099 - joshtriplett:unnecessary-lazy-eval-then-some, r=flip1995
Extend unnecessary_lazy_eval to cover `bool::then` -> `bool::then_some`

fixes #9097

changelog: Extend `unnecessary_lazy_eval` to convert `bool::then` to `bool::then_some`
Diffstat (limited to 'clippy_utils/src')
-rw-r--r--clippy_utils/src/lib.rs2
-rw-r--r--clippy_utils/src/msrvs.rs1
-rw-r--r--clippy_utils/src/source.rs2
3 files changed, 3 insertions, 2 deletions
diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs
index 9fa28e137f9..0e739303683 100644
--- a/clippy_utils/src/lib.rs
+++ b/clippy_utils/src/lib.rs
@@ -1016,7 +1016,7 @@ pub fn can_move_expr_to_closure<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'
         captures: HirIdMap::default(),
     };
     v.visit_expr(expr);
-    v.allow_closure.then(|| v.captures)
+    v.allow_closure.then_some(v.captures)
 }
 
 /// Returns the method names and argument list of nested method call expressions that make up
diff --git a/clippy_utils/src/msrvs.rs b/clippy_utils/src/msrvs.rs
index b09c929f76e..9e238c6f1ac 100644
--- a/clippy_utils/src/msrvs.rs
+++ b/clippy_utils/src/msrvs.rs
@@ -12,6 +12,7 @@ macro_rules! msrv_aliases {
 
 // names may refer to stabilized feature flags or library items
 msrv_aliases! {
+    1,62,0 { BOOL_THEN_SOME }
     1,53,0 { OR_PATTERNS, MANUAL_BITS, BTREE_MAP_RETAIN, BTREE_SET_RETAIN }
     1,52,0 { STR_SPLIT_ONCE, REM_EUCLID_CONST }
     1,51,0 { BORROW_AS_PTR, UNSIGNED_ABS }
diff --git a/clippy_utils/src/source.rs b/clippy_utils/src/source.rs
index f88a92fb11c..1197fe914de 100644
--- a/clippy_utils/src/source.rs
+++ b/clippy_utils/src/source.rs
@@ -353,7 +353,7 @@ pub fn snippet_with_context<'a>(
 /// span containing `m!(0)`.
 pub fn walk_span_to_context(span: Span, outer: SyntaxContext) -> Option<Span> {
     let outer_span = hygiene::walk_chain(span, outer);
-    (outer_span.ctxt() == outer).then(|| outer_span)
+    (outer_span.ctxt() == outer).then_some(outer_span)
 }
 
 /// Removes block comments from the given `Vec` of lines.