Skip to content

Commit 66b855c

Browse files
author
logan-dev-oss
committed
Integrate more idiomatic rust changes.
1 parent 9c89cf0 commit 66b855c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

clippy_lints/src/precedence.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,16 @@ impl EarlyLintPass for Precedence {
104104

105105
if let ExprKind::Unary(UnOp::Neg, ref rhs) = expr.kind {
106106
if let ExprKind::MethodCall(ref path_segment, ref args) = rhs.kind {
107+
let path_segment_str = path_segment.ident.name.as_str();
107108
if let Some(slf) = args.first() {
108109
if let ExprKind::Lit(ref lit) = slf.kind {
109110
match lit.kind {
110111
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;
115117
}
116118
let mut applicability = Applicability::MachineApplicable;
117119
span_lint_and_sugg(

0 commit comments

Comments
 (0)