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 @@ -99,19 +99,11 @@ declare_lint! {
9999
100100declare_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-
110102impl 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
26622654declare_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
You can’t perform that action at this time.
0 commit comments