about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-06-01 23:36:53 +0900
committerGitHub <noreply@github.com>2022-06-01 23:36:53 +0900
commit85fdef087c889846644192553dc6f4ebaf7b4494 (patch)
tree65a1388d9fd21c48e6549dc3d6c0367aac4fe577
parent2c3a8cf0a465705bd010f8952961b9768d1b684e (diff)
parent8d007aa06d01353f7154d5dc681ba5db7c52514f (diff)
downloadrust-85fdef087c889846644192553dc6f4ebaf7b4494.tar.gz
rust-85fdef087c889846644192553dc6f4ebaf7b4494.zip
Rollup merge of #97616 - TaKO8Ki:remove-unnecessary-option, r=Dylan-DPC
Remove an unnecessary `Option`
-rw-r--r--compiler/rustc_trait_selection/src/traits/wf.rs13
-rw-r--r--compiler/rustc_typeck/src/check/wfcheck.rs2
2 files changed, 11 insertions, 4 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs
index 0379b16334c..2ce2a44d3db 100644
--- a/compiler/rustc_trait_selection/src/traits/wf.rs
+++ b/compiler/rustc_trait_selection/src/traits/wf.rs
@@ -81,10 +81,17 @@ pub fn trait_obligations<'a, 'tcx>(
     body_id: hir::HirId,
     trait_ref: &ty::TraitRef<'tcx>,
     span: Span,
-    item: Option<&'tcx hir::Item<'tcx>>,
+    item: &'tcx hir::Item<'tcx>,
 ) -> Vec<traits::PredicateObligation<'tcx>> {
-    let mut wf =
-        WfPredicates { infcx, param_env, body_id, span, out: vec![], recursion_depth: 0, item };
+    let mut wf = WfPredicates {
+        infcx,
+        param_env,
+        body_id,
+        span,
+        out: vec![],
+        recursion_depth: 0,
+        item: Some(item),
+    };
     wf.compute_trait_ref(trait_ref, Elaborate::All);
     debug!(obligations = ?wf.out);
     wf.normalize()
diff --git a/compiler/rustc_typeck/src/check/wfcheck.rs b/compiler/rustc_typeck/src/check/wfcheck.rs
index a6c7573b787..20ef97c085f 100644
--- a/compiler/rustc_typeck/src/check/wfcheck.rs
+++ b/compiler/rustc_typeck/src/check/wfcheck.rs
@@ -1228,7 +1228,7 @@ fn check_impl<'tcx>(
                     fcx.body_id,
                     &trait_ref,
                     ast_trait_ref.path.span,
-                    Some(item),
+                    item,
                 );
                 debug!(?obligations);
                 for obligation in obligations {