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 @@ -90,19 +90,11 @@ declare_lint! {
90
90
91
91
declare_lint_pass ! ( WhileTrue => [ WHILE_TRUE ] ) ;
92
92
93
- /// Traverse through any amount of parenthesis and return the first non-parens expression.
94
- fn pierce_parens ( mut expr : & ast:: Expr ) -> & ast:: Expr {
95
- while let ast:: ExprKind :: Paren ( sub) = & expr. kind {
96
- expr = sub;
97
- }
98
- expr
99
- }
100
-
101
93
impl EarlyLintPass for WhileTrue {
102
94
#[ inline]
103
95
fn check_expr ( & mut self , cx : & EarlyContext < ' _ > , e : & ast:: Expr ) {
104
96
if let ast:: ExprKind :: While ( cond, _, label) = & e. kind
105
- && let ast:: ExprKind :: Lit ( token_lit) = pierce_parens ( cond) . kind
97
+ && let ast:: ExprKind :: Lit ( token_lit) = cond. peel_parens ( ) . kind
106
98
&& let token:: Lit { kind : token:: Bool , symbol : kw:: True , .. } = token_lit
107
99
&& !cond. span . from_expansion ( )
108
100
{
@@ -2651,7 +2643,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
2651
2643
}
2652
2644
2653
2645
declare_lint ! {
2654
- /// The `deref_nullptr` lint detects when an null pointer is dereferenced,
2646
+ /// The `deref_nullptr` lint detects when a null pointer is dereferenced,
2655
2647
/// which causes [undefined behavior].
2656
2648
///
2657
2649
/// ### Example
You can’t perform that action at this time.
0 commit comments