Use the same abstraction for attrs and docs
Doc comments *are* attributes, so there's no reason to have two crates here.
This commit is contained in:
@@ -1771,6 +1771,7 @@ impl_from!(
|
||||
|
||||
pub trait HasAttrs {
|
||||
fn attrs(self, db: &dyn HirDatabase) -> Attrs;
|
||||
fn docs(self, db: &dyn HirDatabase) -> Option<Documentation>;
|
||||
}
|
||||
|
||||
impl<T: Into<AttrDef>> HasAttrs for T {
|
||||
@@ -1778,14 +1779,8 @@ impl<T: Into<AttrDef>> HasAttrs for T {
|
||||
let def: AttrDef = self.into();
|
||||
db.attrs(def.into())
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Docs {
|
||||
fn docs(&self, db: &dyn HirDatabase) -> Option<Documentation>;
|
||||
}
|
||||
impl<T: Into<AttrDef> + Copy> Docs for T {
|
||||
fn docs(&self, db: &dyn HirDatabase) -> Option<Documentation> {
|
||||
let def: AttrDef = (*self).into();
|
||||
fn docs(self, db: &dyn HirDatabase) -> Option<Documentation> {
|
||||
let def: AttrDef = self.into();
|
||||
db.documentation(def.into())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user