Avoid invoking the full eq infrastructure when all we want is to check a discriminant

This commit is contained in:
Oli Scherer 2022-05-13 09:30:09 +00:00
parent 72f144de24
commit 59bbbe78e2

View File

@ -206,7 +206,9 @@ pub struct InternedObligationCauseCode<'tcx> {
impl<'tcx> From<ObligationCauseCode<'tcx>> for InternedObligationCauseCode<'tcx> {
#[inline(always)]
fn from(code: ObligationCauseCode<'tcx>) -> Self {
Self { code: if code == MISC_OBLIGATION_CAUSE_CODE { None } else { Some(Lrc::new(code)) } }
Self {
code: if let MISC_OBLIGATION_CAUSE_CODE = code { None } else { Some(Lrc::new(code)) },
}
}
}