Skip to content

Commit 7e7240a

Browse files
committed
unrelated cleanup
1 parent 9b584a6 commit 7e7240a

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

105105
declare_lint_pass!(WhileTrue => [WHILE_TRUE]);
106106

107-
/// Traverse through any amount of parenthesis and return the first non-parens expression.
108-
fn pierce_parens(mut expr: &ast::Expr) -> &ast::Expr {
109-
while let ast::ExprKind::Paren(sub) = &expr.kind {
110-
expr = sub;
111-
}
112-
expr
113-
}
114-
115107
impl EarlyLintPass for WhileTrue {
116108
#[inline]
117109
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
118110
if let ast::ExprKind::While(cond, _, label) = &e.kind
119-
&& let ast::ExprKind::Lit(token_lit) = pierce_parens(cond).kind
111+
&& let ast::ExprKind::Lit(token_lit) = cond.peel_parens().kind
120112
&& let token::Lit { kind: token::Bool, symbol: kw::True, .. } = token_lit
121113
&& !cond.span.from_expansion()
122114
{
@@ -2688,7 +2680,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
26882680
}
26892681

26902682
declare_lint! {
2691-
/// The `deref_nullptr` lint detects when an null pointer is dereferenced,
2683+
/// The `deref_nullptr` lint detects when a null pointer is dereferenced,
26922684
/// which causes [undefined behavior].
26932685
///
26942686
/// ### Example

0 commit comments

Comments
 (0)