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 @@ -104,19 +104,11 @@ declare_lint! {
104
104
105
105
declare_lint_pass ! ( WhileTrue => [ WHILE_TRUE ] ) ;
106
106
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
-
115
107
impl EarlyLintPass for WhileTrue {
116
108
#[ inline]
117
109
fn check_expr ( & mut self , cx : & EarlyContext < ' _ > , e : & ast:: Expr ) {
118
110
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
120
112
&& let token:: Lit { kind : token:: Bool , symbol : kw:: True , .. } = token_lit
121
113
&& !cond. span . from_expansion ( )
122
114
{
@@ -2688,7 +2680,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
2688
2680
}
2689
2681
2690
2682
declare_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,
2692
2684
/// which causes [undefined behavior].
2693
2685
///
2694
2686
/// ### Example
You can’t perform that action at this time.
0 commit comments