// attribute which does exist on the comparison trait methods
hir::ExprKind::Binary(bin_op, ..) => {
match bin_op.node {
- hir::BinOpKind::Eq | hir::BinOpKind::Lt | hir::BinOpKind::Le | hir::BinOpKind::Ne | hir::BinOpKind::Ge | hir::BinOpKind::Gt => {
+ hir::BinOpKind::Eq |
+ hir::BinOpKind::Lt |
+ hir::BinOpKind::Le |
+ hir::BinOpKind::Ne |
+ hir::BinOpKind::Ge |
+ hir::BinOpKind::Gt => {
Some("comparison")
},
- hir::BinOpKind::Add | hir::BinOpKind::Sub | hir::BinOpKind::Div | hir::BinOpKind::Mul | hir::BinOpKind::Rem => {
+ hir::BinOpKind::Add |
+ hir::BinOpKind::Sub |
+ hir::BinOpKind::Div |
+ hir::BinOpKind::Mul |
+ hir::BinOpKind::Rem => {
Some("arithmetic operation")
},
hir::BinOpKind::And | hir::BinOpKind::Or => {
Some("logical operation")
},
- hir::BinOpKind::BitXor | hir::BinOpKind::BitAnd | hir::BinOpKind::BitOr | hir::BinOpKind::Shl | hir::BinOpKind::Shr => {
+ hir::BinOpKind::BitXor |
+ hir::BinOpKind::BitAnd |
+ hir::BinOpKind::BitOr |
+ hir::BinOpKind::Shl |
+ hir::BinOpKind::Shr => {
Some("bitwise operation")
},
}
fn check_must_use(cx: &LateContext, def_id: DefId, sp: Span, describe_path: &str) -> bool {
for attr in cx.tcx.get_attrs(def_id).iter() {
if attr.check_name("must_use") {
- let mut msg = format!("unused {}`{}` which must be used",
+ let msg = format!("unused {}`{}` which must be used",
describe_path, cx.tcx.item_path_str(def_id));
let mut err = cx.struct_span_lint(UNUSED_MUST_USE, sp, &msg);
// check for #[must_use = "..."]