Skip to content

Commit d810d42

Browse files
committed
unrelated cleanup
1 parent c2270be commit d810d42

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

compiler/rustc_lint/src/builtin.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,11 @@ declare_lint! {
9090

9191
declare_lint_pass!(WhileTrue => [WHILE_TRUE]);
9292

93-
/// Traverse through any amount of parenthesis and return the first non-parens expression.
94-
fn pierce_parens(mut expr: &ast::Expr) -> &ast::Expr {
95-
while let ast::ExprKind::Paren(sub) = &expr.kind {
96-
expr = sub;
97-
}
98-
expr
99-
}
100-
10193
impl EarlyLintPass for WhileTrue {
10294
#[inline]
10395
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
10496
if let ast::ExprKind::While(cond, _, label) = &e.kind
105-
&& let ast::ExprKind::Lit(token_lit) = pierce_parens(cond).kind
97+
&& let ast::ExprKind::Lit(token_lit) = cond.peel_parens().kind
10698
&& let token::Lit { kind: token::Bool, symbol: kw::True, .. } = token_lit
10799
&& !cond.span.from_expansion()
108100
{
@@ -2651,7 +2643,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
26512643
}
26522644

26532645
declare_lint! {
2654-
/// The `deref_nullptr` lint detects when an null pointer is dereferenced,
2646+
/// The `deref_nullptr` lint detects when a null pointer is dereferenced,
26552647
/// which causes [undefined behavior].
26562648
///
26572649
/// ### Example

0 commit comments

Comments
 (0)