Lint redundant clone of projection

This commit is contained in:
Shotaro Yamada
2018-12-09 20:19:21 +09:00
parent a4fe567602
commit 109d4b1ab3
5 changed files with 106 additions and 23 deletions

View File

@@ -266,9 +266,8 @@ pub fn implements_trait<'a, 'tcx>(
}
/// Check whether this type implements Drop.
pub fn has_drop(cx: &LateContext<'_, '_>, expr: &Expr) -> bool {
let struct_ty = cx.tables.expr_ty(expr);
match struct_ty.ty_adt_def() {
pub fn has_drop<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>) -> bool {
match ty.ty_adt_def() {
Some(def) => def.has_dtor(cx.tcx),
_ => false,
}