File tree 1 file changed +2
-10
lines changed
1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -91,19 +91,11 @@ declare_lint! {
91
91
92
92
declare_lint_pass ! ( WhileTrue => [ WHILE_TRUE ] ) ;
93
93
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
-
102
94
impl EarlyLintPass for WhileTrue {
103
95
#[ inline]
104
96
fn check_expr ( & mut self , cx : & EarlyContext < ' _ > , e : & ast:: Expr ) {
105
97
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
107
99
&& let token:: Lit { kind : token:: Bool , symbol : kw:: True , .. } = token_lit
108
100
&& !cond. span . from_expansion ( )
109
101
{
@@ -2636,7 +2628,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
2636
2628
}
2637
2629
2638
2630
declare_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,
2640
2632
/// which causes [undefined behavior].
2641
2633
///
2642
2634
/// ### Example
You can’t perform that action at this time.
0 commit comments