File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed
Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -91,19 +91,11 @@ declare_lint! {
9191
9292declare_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-
10294impl 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
26382630declare_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
You can’t perform that action at this time.
0 commit comments