Rollup merge of #76809 - matthiaskrgr:simplify_cond, r=varkor

simplfy condition in ItemLowerer::with_trait_impl_ref()
This commit is contained in:
Ralf Jung 2020-09-20 12:08:17 +02:00 committed by GitHub
commit 9b9192a2d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,7 @@ pub(super) struct ItemLowerer<'a, 'lowering, 'hir> {
impl ItemLowerer<'_, '_, '_> {
fn with_trait_impl_ref(&mut self, impl_ref: &Option<TraitRef>, f: impl FnOnce(&mut Self)) {
let old = self.lctx.is_in_trait_impl;
self.lctx.is_in_trait_impl = if let &None = impl_ref { false } else { true };
self.lctx.is_in_trait_impl = impl_ref.is_some();
f(self);
self.lctx.is_in_trait_impl = old;
}