Dogfood fixes to use bool::then_some

This commit is contained in:
Josh Triplett
2022-07-06 00:52:53 -07:00
parent ebff7206bc
commit b7230d4f44
16 changed files with 20 additions and 18 deletions

View File

@@ -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

View File

@@ -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.