Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Oct 15, 2019
1 parent 7de7d0c commit 9e566db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,12 @@ fn simplify_not(cx: &LateContext<'_, '_>, expr: &Expr) -> Option<String> {
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,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9e566db

Please sign in to comment.