Skip to content

Commit 9e566db

Browse files
committed
1 parent 7de7d0c commit 9e566db

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clippy_lints/src/booleans.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,12 @@ fn simplify_not(cx: &LateContext<'_, '_>, expr: &Expr) -> Option<String> {
251251
if !match_type(cx, type_of_receiver, &paths::OPTION) && !match_type(cx, type_of_receiver, &paths::RESULT) {
252252
return None;
253253
}
254+
let ident_name: &str = &path.ident.name.as_str();
254255
METHODS_WITH_NEGATION
255256
.iter()
256257
.cloned()
257258
.flat_map(|(a, b)| vec![(a, b), (b, a)])
258-
.find(|&(a, _)| a == path.ident.name.as_str())
259+
.find(|&(a, _)| a == ident_name)
259260
.and_then(|(_, neg_method)| Some(format!("{}.{}()", snippet_opt(cx, args[0].span)?, neg_method)))
260261
},
261262
_ => None,

clippy_lints/src/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ fn check_must_use_candidate<'a, 'tcx>(
464464
fn must_use_attr(attrs: &[Attribute]) -> Option<&Attribute> {
465465
attrs
466466
.iter()
467-
.find(|attr| attr.ident().map_or(false, |ident| "must_use" == &ident.as_str()))
467+
.find(|attr| attr.ident().map_or(false, |ident| sym!("must_use") == ident.name))
468468
}
469469

470470
fn returns_unit(decl: &hir::FnDecl) -> bool {

0 commit comments

Comments
 (0)