diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-05-13 09:30:09 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-05-13 09:31:46 +0000 |
| commit | 59bbbe78e2ddf6f5c823372890b928fe19e41ac3 (patch) | |
| tree | d090f3ea28b303060318db8fe281681d6d0653e7 /compiler | |
| parent | 72f144de242499776d8ca2f6626d63d169781a05 (diff) | |
| download | rust-59bbbe78e2ddf6f5c823372890b928fe19e41ac3.tar.gz rust-59bbbe78e2ddf6f5c823372890b928fe19e41ac3.zip | |
Avoid invoking the full `eq` infrastructure when all we want is to check a discriminant
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_middle/src/traits/mod.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index 8072dd16ae8..dcd457957a8 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -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)) }, + } } } |
