mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
Remove HasVisibility implementation
This commit is contained in:
parent
bd9f1f7eb7
commit
210f0cbd27
@ -474,13 +474,6 @@ impl EnumVariant {
|
||||
}
|
||||
}
|
||||
|
||||
impl HasVisibility for EnumVariant {
|
||||
fn visibility(&self, db: &dyn HirDatabase) -> Visibility {
|
||||
let visibility = &db.enum_data(self.parent.id).visibility;
|
||||
visibility.resolve(db.upcast(), &self.parent.id.resolver(db.upcast()))
|
||||
}
|
||||
}
|
||||
|
||||
/// A Data Type
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum Adt {
|
||||
|
@ -33,7 +33,6 @@ pub struct StructData {
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct EnumData {
|
||||
pub name: Name,
|
||||
pub visibility: RawVisibility,
|
||||
pub variants: Arena<EnumVariantData>,
|
||||
}
|
||||
|
||||
@ -92,8 +91,7 @@ impl EnumData {
|
||||
let name = src.value.name().map_or_else(Name::missing, |n| n.as_name());
|
||||
let mut trace = Trace::new_for_arena();
|
||||
lower_enum(db, &mut trace, &src, e.lookup(db).container.module(db));
|
||||
let visibility = RawVisibility::from_ast(db, src.with_value(src.value.visibility()));
|
||||
Arc::new(EnumData { name, visibility, variants: trace.into_arena() })
|
||||
Arc::new(EnumData { name, variants: trace.into_arena() })
|
||||
}
|
||||
|
||||
pub fn variant(&self, name: &Name) -> Option<LocalEnumVariantId> {
|
||||
|
@ -6,7 +6,7 @@
|
||||
// FIXME: this badly needs rename/rewrite (matklad, 2020-02-06).
|
||||
|
||||
use hir::{
|
||||
Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution,
|
||||
Adt, Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution,
|
||||
Semantics, TypeParam, Visibility,
|
||||
};
|
||||
use ra_prof::profile;
|
||||
@ -48,7 +48,10 @@ impl Definition {
|
||||
Definition::Macro(_) => None,
|
||||
Definition::Field(sf) => Some(sf.visibility(db)),
|
||||
Definition::ModuleDef(def) => match def {
|
||||
ModuleDef::EnumVariant(id) => Some(id.visibility(db)),
|
||||
ModuleDef::EnumVariant(id) => {
|
||||
let parent = id.parent_enum(db);
|
||||
module?.visibility_of(db, &ModuleDef::Adt(Adt::Enum(parent)))
|
||||
}
|
||||
_ => module?.visibility_of(db, def),
|
||||
},
|
||||
Definition::SelfType(_) => None,
|
||||
|
Loading…
Reference in New Issue
Block a user