Skip to content

Commit a29c770

Browse files
committed
make match exaustive
1 parent 59e778e commit a29c770

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/librustc/ty/instance.rs

+13-10
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,17 @@ fn resolve_associated_item<'a, 'tcx>(
247247
substs: rcvr_substs
248248
})
249249
}
250-
traits::VtableBuiltin(..) if Some(trait_id) == tcx.lang_items().clone_trait() => {
251-
Some(Instance {
252-
def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()),
253-
substs: rcvr_substs
254-
})
255-
}
256-
_ => {
257-
None
250+
traits::VtableBuiltin(..) => {
251+
if let Some(_) = tcx.lang_items().clone_trait() {
252+
Some(Instance {
253+
def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()),
254+
substs: rcvr_substs
255+
})
256+
} else {
257+
None
258+
}
258259
}
260+
traits::VtableDefaultImpl(..) | traits::VtableParam(..) => None
259261
}
260262
}
261263

@@ -287,8 +289,9 @@ fn needs_fn_once_adapter_shim<'a, 'tcx>(actual_closure_kind: ty::ClosureKind,
287289
//
288290
// These are both the same at trans time.
289291
Ok(true)
290-
}
291-
_ => Err(()),
292+
}
293+
(ty::ClosureKind::FnMut, _) |
294+
(ty::ClosureKind::FnOnce, _) => Err(())
292295
}
293296
}
294297

0 commit comments

Comments
 (0)