Simplify macro rendering, remove constructor structs

This commit is contained in:
Lukas Wirth 2021-12-21 15:20:15 +01:00
parent 2b60d80eaf
commit 97f7865c56
3 changed files with 88 additions and 86 deletions

View file

@ -47,8 +47,8 @@ impl<'a> RenderContext<'a> {
self.completion.source_range()
}
fn is_deprecated(&self, node: impl HasAttrs) -> bool {
let attrs = node.attrs(self.db());
fn is_deprecated(&self, def: impl HasAttrs) -> bool {
let attrs = def.attrs(self.db());
attrs.by_key("deprecated").exists() || attrs.by_key("rustc_deprecated").exists()
}
@ -71,8 +71,8 @@ impl<'a> RenderContext<'a> {
.unwrap_or(false)
}
fn docs(&self, node: impl HasAttrs) -> Option<hir::Documentation> {
node.docs(self.db())
fn docs(&self, def: impl HasAttrs) -> Option<hir::Documentation> {
def.docs(self.db())
}
}