Skip to content

Commit 59bbbe7

Browse files
committed
Avoid invoking the full eq infrastructure when all we want is to check a discriminant
1 parent 72f144d commit 59bbbe7

File tree

1 file changed

+3
-1
lines changed
  • compiler/rustc_middle/src/traits

1 file changed

+3
-1
lines changed

compiler/rustc_middle/src/traits/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ pub struct InternedObligationCauseCode<'tcx> {
206206
impl<'tcx> From<ObligationCauseCode<'tcx>> for InternedObligationCauseCode<'tcx> {
207207
#[inline(always)]
208208
fn from(code: ObligationCauseCode<'tcx>) -> Self {
209-
Self { code: if code == MISC_OBLIGATION_CAUSE_CODE { None } else { Some(Lrc::new(code)) } }
209+
Self {
210+
code: if let MISC_OBLIGATION_CAUSE_CODE = code { None } else { Some(Lrc::new(code)) },
211+
}
210212
}
211213
}
212214

0 commit comments

Comments
 (0)