Skip to content

Commit 6e1d848

Browse files
committed
tmandry nits
1 parent 8f470b3 commit 6e1d848

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

src/lowering.rs

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,35 @@ impl LowerPolarity for Polarity {
780780
}
781781
}
782782

783+
trait LowerImplType {
784+
fn lower(&self) -> rust_ir::ImplType;
785+
}
786+
787+
impl LowerImplType for ImplType {
788+
fn lower(&self) -> rust_ir::ImplType {
789+
match self {
790+
ImplType::Local => rust_ir::ImplType::Local,
791+
ImplType::External => rust_ir::ImplType::External,
792+
}
793+
}
794+
}
795+
796+
trait LowerTraitFlags {
797+
fn lower(&self) -> rust_ir::TraitFlags;
798+
}
799+
800+
impl LowerTraitFlags for TraitFlags {
801+
fn lower(&self) -> rust_ir::TraitFlags {
802+
rust_ir::TraitFlags {
803+
auto: self.auto,
804+
marker: self.marker,
805+
upstream: self.upstream,
806+
fundamental: self.fundamental,
807+
non_enumerable: self.non_enumerable,
808+
}
809+
}
810+
}
811+
783812
trait LowerProjectionTy {
784813
fn lower(&self, env: &Env) -> Fallible<chalk_ir::ProjectionTy>;
785814
}
@@ -966,10 +995,7 @@ impl LowerImpl for Impl {
966995
Ok(rust_ir::ImplDatum {
967996
polarity,
968997
binders: binders,
969-
impl_type: match self.impl_type {
970-
ImplType::Local => rust_ir::ImplType::Local,
971-
ImplType::External => rust_ir::ImplType::External,
972-
},
998+
impl_type: self.impl_type.lower(),
973999
})
9741000
}
9751001
}
@@ -1086,13 +1112,7 @@ impl LowerTrait for TraitDefn {
10861112

10871113
Ok(rust_ir::TraitDatum {
10881114
binders: binders,
1089-
flags: rust_ir::TraitFlags {
1090-
auto: self.flags.auto,
1091-
marker: self.flags.marker,
1092-
upstream: self.flags.upstream,
1093-
fundamental: self.flags.fundamental,
1094-
non_enumerable: self.flags.non_enumerable,
1095-
},
1115+
flags: self.flags.lower(),
10961116
})
10971117
}
10981118
}

0 commit comments

Comments
 (0)