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 @@ -104,19 +104,11 @@ declare_lint! {
104104
105105declare_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-
115107impl 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
26902682declare_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
You can’t perform that action at this time.
0 commit comments