diff --git a/clippy_lints/src/booleans.rs b/clippy_lints/src/booleans.rs index c5da0af6f4d1..670c1a9def56 100644 --- a/clippy_lints/src/booleans.rs +++ b/clippy_lints/src/booleans.rs @@ -251,11 +251,12 @@ fn simplify_not(cx: &LateContext<'_, '_>, expr: &Expr) -> Option { if !match_type(cx, type_of_receiver, &paths::OPTION) && !match_type(cx, type_of_receiver, &paths::RESULT) { return None; } + let ident_name: &str = &path.ident.name.as_str(); METHODS_WITH_NEGATION .iter() .cloned() .flat_map(|(a, b)| vec![(a, b), (b, a)]) - .find(|&(a, _)| a == path.ident.name.as_str()) + .find(|&(a, _)| a == ident_name) .and_then(|(_, neg_method)| Some(format!("{}.{}()", snippet_opt(cx, args[0].span)?, neg_method))) }, _ => None, diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index 5b2619aa9ba7..779165cd6c89 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -464,7 +464,7 @@ fn check_must_use_candidate<'a, 'tcx>( fn must_use_attr(attrs: &[Attribute]) -> Option<&Attribute> { attrs .iter() - .find(|attr| attr.ident().map_or(false, |ident| "must_use" == &ident.as_str())) + .find(|attr| attr.ident().map_or(false, |ident| sym!("must_use") == ident.name)) } fn returns_unit(decl: &hir::FnDecl) -> bool {