about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-05-13 09:30:09 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-05-13 09:31:46 +0000
commit59bbbe78e2ddf6f5c823372890b928fe19e41ac3 (patch)
treed090f3ea28b303060318db8fe281681d6d0653e7 /compiler
parent72f144de242499776d8ca2f6626d63d169781a05 (diff)
downloadrust-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.rs4
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)) },
+        }
     }
 }