Save variant names in EnumData to reduce needless queries

We already have their names when anyway, and when in all (current)
situations where we're interested in an Enum's variants, we want
their names.
This commit is contained in:
Marcus Klaas de Vries 2019-01-10 02:07:42 +01:00
parent 978de5cf8b
commit e78286c8e8
4 changed files with 24 additions and 38 deletions

View file

@ -201,7 +201,7 @@ impl Enum {
Ok(db.enum_data(self.def_id)?.name.clone())
}
pub fn variants(&self, db: &impl HirDatabase) -> Cancelable<Option<Vec<EnumVariant>>> {
pub fn variants(&self, db: &impl HirDatabase) -> Cancelable<Vec<(Name, EnumVariant)>> {
Ok(db.enum_data(self.def_id)?.variants.clone())
}
}