File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -104,14 +104,16 @@ impl EarlyLintPass for Precedence {
104
104
105
105
if let ExprKind :: Unary ( UnOp :: Neg , ref rhs) = expr. kind {
106
106
if let ExprKind :: MethodCall ( ref path_segment, ref args) = rhs. kind {
107
+ let path_segment_str = path_segment. ident . name . as_str ( ) ;
107
108
if let Some ( slf) = args. first ( ) {
108
109
if let ExprKind :: Lit ( ref lit) = slf. kind {
109
110
match lit. kind {
110
111
LitKind :: Int ( ..) | LitKind :: Float ( ..) => {
111
- for & odd_function in & ODD_FUNCTIONS_WHITELIST {
112
- if odd_function == & * path_segment. ident . name . as_str ( ) {
113
- return ;
114
- }
112
+ if ODD_FUNCTIONS_WHITELIST
113
+ . iter ( )
114
+ . any ( |odd_function| * * odd_function == * path_segment_str)
115
+ {
116
+ return ;
115
117
}
116
118
let mut applicability = Applicability :: MachineApplicable ;
117
119
span_lint_and_sugg (
You can’t perform that action at this time.
0 commit comments