1
Fork 0

Fix some more clippy warnings

This commit is contained in:
Joshua Nelson 2020-10-26 20:02:06 -04:00
parent 388ef34904
commit bfecb18771
16 changed files with 71 additions and 97 deletions

View file

@ -1369,10 +1369,9 @@ impl TypeAliasBounds {
hir::QPath::TypeRelative(ref ty, _) => {
// If this is a type variable, we found a `T::Assoc`.
match ty.kind {
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => match path.res {
Res::Def(DefKind::TyParam, _) => true,
_ => false,
},
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
matches!(path.res, Res::Def(DefKind::TyParam, _))
}
_ => false,
}
}
@ -2381,10 +2380,9 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
return Some(InitKind::Zeroed);
} else if cx.tcx.is_diagnostic_item(sym::mem_uninitialized, def_id) {
return Some(InitKind::Uninit);
} else if cx.tcx.is_diagnostic_item(sym::transmute, def_id) {
if is_zero(&args[0]) {
return Some(InitKind::Zeroed);
}
} else if cx.tcx.is_diagnostic_item(sym::transmute, def_id) && is_zero(&args[0])
{
return Some(InitKind::Zeroed);
}
}
} else if let hir::ExprKind::MethodCall(_, _, ref args, _) = expr.kind {
@ -2880,7 +2878,7 @@ impl<'tcx> LateLintPass<'tcx> for ClashingExternDeclarations {
fn check_foreign_item(&mut self, cx: &LateContext<'tcx>, this_fi: &hir::ForeignItem<'_>) {
trace!("ClashingExternDeclarations: check_foreign_item: {:?}", this_fi);
if let ForeignItemKind::Fn(..) = this_fi.kind {
let tcx = *&cx.tcx;
let tcx = cx.tcx;
if let Some(existing_hid) = self.insert(tcx, this_fi) {
let existing_decl_ty = tcx.type_of(tcx.hir().local_def_id(existing_hid));
let this_decl_ty = tcx.type_of(tcx.hir().local_def_id(this_fi.hir_id));