Skip to content

Commit

Permalink
Integrate more idiomatic rust changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-dev-oss committed Apr 17, 2020
1 parent 9c89cf0 commit 66b855c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions clippy_lints/src/precedence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ impl EarlyLintPass for Precedence {

if let ExprKind::Unary(UnOp::Neg, ref rhs) = expr.kind {
if let ExprKind::MethodCall(ref path_segment, ref args) = rhs.kind {
let path_segment_str = path_segment.ident.name.as_str();
if let Some(slf) = args.first() {
if let ExprKind::Lit(ref lit) = slf.kind {
match lit.kind {
LitKind::Int(..) | LitKind::Float(..) => {
for &odd_function in &ODD_FUNCTIONS_WHITELIST {
if odd_function == &*path_segment.ident.name.as_str() {
return;
}
if ODD_FUNCTIONS_WHITELIST
.iter()
.any(|odd_function| **odd_function == *path_segment_str)
{
return;
}
let mut applicability = Applicability::MachineApplicable;
span_lint_and_sugg(
Expand Down

0 comments on commit 66b855c

Please sign in to comment.