From 795fa0a006bed5526e762a8bb11284da96ddf57d Mon Sep 17 00:00:00 2001 From: marmeladema Date: Sun, 12 Apr 2020 21:22:30 +0100 Subject: [PATCH] Remove useless calls to `assemble_extension_candidates_for_traits_in_scope` Calls to `assemble_extension_candidates_for_traits_in_scope` with `DUMMY_HIR_ID` as `expr_hir_id` are useless because the first thing that this function does is to return `Ok(())` in this case. --- src/librustc_typeck/check/method/probe.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 7e7d84c19967..0b1aff7e806c 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -1513,7 +1513,6 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { ); pcx.allow_similar_names = true; pcx.assemble_inherent_candidates(); - pcx.assemble_extension_candidates_for_traits_in_scope(hir::DUMMY_HIR_ID)?; let method_names = pcx.candidate_method_names(); pcx.allow_similar_names = false; @@ -1523,10 +1522,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { pcx.reset(); pcx.method_name = Some(method_name); pcx.assemble_inherent_candidates(); - pcx.assemble_extension_candidates_for_traits_in_scope(hir::DUMMY_HIR_ID) - .map_or(None, |_| { - pcx.pick_core().and_then(|pick| pick.ok()).map(|pick| pick.item) - }) + pcx.pick_core().and_then(|pick| pick.ok()).map(|pick| pick.item) }) .collect();