mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Move traits to the new loc
This commit is contained in:
parent
7b0644d81e
commit
82e9b24558
16 changed files with 70 additions and 35 deletions
|
@ -44,8 +44,10 @@ impl FromSource for Enum {
|
|||
impl FromSource for Trait {
|
||||
type Ast = ast::TraitDef;
|
||||
fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
|
||||
let id = from_source(db, src)?;
|
||||
Some(Trait { id })
|
||||
// XXX: use `.parent()` to avoid finding ourselves
|
||||
let parent = src.value.syntax().parent()?;
|
||||
let container = Container::find(db, src.with_value(parent).as_ref())?;
|
||||
container.child_by_source(db)[keys::TRAIT].get(&src).copied().map(Trait::from)
|
||||
}
|
||||
}
|
||||
impl FromSource for Function {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue