Skip to content

Commit 8f53926

Browse files
committed
Alloc hir::Lit in an arena to remove the destructor from Expr
This allows allocating `Expr`s into a dropless arena, which is useful for using length prefixed thing slices in HIR, since these can only be allocated in the dropless arena and not in a typed arena. This is something I'm working on.
1 parent d61570c commit 8f53926

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

clippy_lints/src/bool_assert_comparison.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn extract_bool_lit(e: &Expr<'_>) -> Option<bool> {
4141
}) = e.kind
4242
&& !e.span.from_expansion()
4343
{
44-
Some(b)
44+
Some(*b)
4545
} else {
4646
None
4747
}

clippy_lints/src/manual_strip.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ fn eq_pattern_length<'tcx>(cx: &LateContext<'tcx>, pattern: &Expr<'_>, expr: &'t
159159
..
160160
}) = expr.kind
161161
{
162-
constant_length(cx, pattern).map_or(false, |length| length == n)
162+
constant_length(cx, pattern).map_or(false, |length| length == *n)
163163
} else {
164164
len_arg(cx, expr).map_or(false, |arg| eq_expr_value(cx, pattern, arg))
165165
}

clippy_lints/src/matches/match_like_matches.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn find_bool_lit(ex: &ExprKind<'_>) -> Option<bool> {
162162
node: LitKind::Bool(b), ..
163163
}) = exp.kind
164164
{
165-
Some(b)
165+
Some(*b)
166166
} else {
167167
None
168168
}

clippy_lints/src/methods/open_options.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn get_open_options(cx: &LateContext<'_>, argument: &Expr<'_>, options: &mut Vec
4848
..
4949
} = *span
5050
{
51-
if lit { Argument::True } else { Argument::False }
51+
if *lit { Argument::True } else { Argument::False }
5252
} else {
5353
// The function is called with a literal which is not a boolean literal.
5454
// This is theoretically possible, but not very likely.

clippy_lints/src/utils/author.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
430430
kind!("Unary(UnOp::{op:?}, {inner})");
431431
self.expr(inner);
432432
},
433-
ExprKind::Lit(ref lit) => {
433+
ExprKind::Lit(lit) => {
434434
bind!(self, lit);
435435
kind!("Lit(ref {lit})");
436436
self.lit(lit);

0 commit comments

Comments
 (0)