We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9c89cf0 commit 66b855cCopy full SHA for 66b855c
clippy_lints/src/precedence.rs
@@ -104,14 +104,16 @@ impl EarlyLintPass for Precedence {
104
105
if let ExprKind::Unary(UnOp::Neg, ref rhs) = expr.kind {
106
if let ExprKind::MethodCall(ref path_segment, ref args) = rhs.kind {
107
+ let path_segment_str = path_segment.ident.name.as_str();
108
if let Some(slf) = args.first() {
109
if let ExprKind::Lit(ref lit) = slf.kind {
110
match lit.kind {
111
LitKind::Int(..) | LitKind::Float(..) => {
- for &odd_function in &ODD_FUNCTIONS_WHITELIST {
112
- if odd_function == &*path_segment.ident.name.as_str() {
113
- return;
114
- }
+ if ODD_FUNCTIONS_WHITELIST
+ .iter()
+ .any(|odd_function| **odd_function == *path_segment_str)
115
+ {
116
+ return;
117
}
118
let mut applicability = Applicability::MachineApplicable;
119
span_lint_and_sugg(
0 commit comments