Skip to content

Commit b34811b

Browse files
committed
unrelated cleanup
1 parent 1a1cc05 commit b34811b

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

100100
declare_lint_pass!(WhileTrue => [WHILE_TRUE]);
101101

102-
/// Traverse through any amount of parenthesis and return the first non-parens expression.
103-
fn pierce_parens(mut expr: &ast::Expr) -> &ast::Expr {
104-
while let ast::ExprKind::Paren(sub) = &expr.kind {
105-
expr = sub;
106-
}
107-
expr
108-
}
109-
110102
impl EarlyLintPass for WhileTrue {
111103
#[inline]
112104
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
113105
if let ast::ExprKind::While(cond, _, label) = &e.kind
114-
&& let ast::ExprKind::Lit(token_lit) = pierce_parens(cond).kind
106+
&& let ast::ExprKind::Lit(token_lit) = cond.peel_parens().kind
115107
&& let token::Lit { kind: token::Bool, symbol: kw::True, .. } = token_lit
116108
&& !cond.span.from_expansion()
117109
{
@@ -2660,7 +2652,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
26602652
}
26612653

26622654
declare_lint! {
2663-
/// The `deref_nullptr` lint detects when an null pointer is dereferenced,
2655+
/// The `deref_nullptr` lint detects when a null pointer is dereferenced,
26642656
/// which causes [undefined behavior].
26652657
///
26662658
/// ### Example

0 commit comments

Comments
 (0)