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 @@ -99,19 +99,11 @@ declare_lint! {
99
99
100
100
declare_lint_pass ! ( WhileTrue => [ WHILE_TRUE ] ) ;
101
101
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
-
110
102
impl EarlyLintPass for WhileTrue {
111
103
#[ inline]
112
104
fn check_expr ( & mut self , cx : & EarlyContext < ' _ > , e : & ast:: Expr ) {
113
105
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
115
107
&& let token:: Lit { kind : token:: Bool , symbol : kw:: True , .. } = token_lit
116
108
&& !cond. span . from_expansion ( )
117
109
{
@@ -2660,7 +2652,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
2660
2652
}
2661
2653
2662
2654
declare_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,
2664
2656
/// which causes [undefined behavior].
2665
2657
///
2666
2658
/// ### Example
You can’t perform that action at this time.
0 commit comments