Skip to content

Commit db80bdd

Browse files
committed
unrelated cleanup
1 parent 2df8dbb commit db80bdd

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
@@ -91,19 +91,11 @@ declare_lint! {
9191

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

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

26382630
declare_lint! {
2639-
/// The `deref_nullptr` lint detects when an null pointer is dereferenced,
2631+
/// The `deref_nullptr` lint detects when a null pointer is dereferenced,
26402632
/// which causes [undefined behavior].
26412633
///
26422634
/// ### Example

0 commit comments

Comments
 (0)