Update trait check

This commit is contained in:
mejrs 2022-11-19 13:31:51 +01:00
parent 4ced370f7c
commit b209ff27f3

View File

@ -769,10 +769,13 @@ fn check_item(&mut self, cx: &LateContext<'_>, item: &hir::Item<'_>) {
// We shouldn't recommend implementing `Copy` on stateful things, // We shouldn't recommend implementing `Copy` on stateful things,
// such as iterators. // such as iterators.
if let Some(iter_trait) = cx.tcx.get_diagnostic_item(sym::Iterator) { if let Some(iter_trait) = cx.tcx.get_diagnostic_item(sym::Iterator) {
if cx.tcx.infer_ctxt().enter(|infer_ctxt| { if cx.tcx.infer_ctxt().build().type_implements_trait(
infer_ctxt.type_implements_trait(iter_trait, ty, List::empty(), param_env) iter_trait,
== EvaluationResult::EvaluatedToOk ty,
}) { List::empty(),
param_env,
) == EvaluationResult::EvaluatedToOk
{
return; return;
} }
} }