pub(crate) fn doc_owner_to_def(
    sema: &Semantics<RootDatabase>,
    item: SyntaxNode,
) -> Option<Definition> {
    let res: hir::ModuleDef = match_ast! {
        match item {
            ast::SourceFile(_it) => sema.scope(&item).module()?.into(),
            ast::Fn(it) => sema.to_def(&it)?.into(),
            ast::Struct(it) => sema.to_def(&it)?.into(),
            ast::Enum(it) => sema.to_def(&it)?.into(),
            ast::Union(it) => sema.to_def(&it)?.into(),
            ast::Trait(it) => sema.to_def(&it)?.into(),
            ast::Const(it) => sema.to_def(&it)?.into(),
            ast::Static(it) => sema.to_def(&it)?.into(),
            ast::TypeAlias(it) => sema.to_def(&it)?.into(),
            _ => return None,
        }
    };
    Some(Definition::ModuleDef(res))
}
// FIXME: figure out a proper API here.
figure out a proper API here.
figure out a proper API here .
pub(crate) fn doc_owner_to_def(
    sema: &Semantics<RootDatabase>,
    item: SyntaxNode,
) -> Option<Definition> {
    let res: hir::ModuleDef = match_ast! {
        match item {
            ast::SourceFile(_it) => sema.scope(&item).module()?.into(),
            ast::Fn(it) => sema.to_def(&it)?.into(),
            ast::Struct(it) => sema.to_def(&it)?.into(),
            ast::Enum(it) => sema.to_def(&it)?.into(),
            ast::Union(it) => sema.to_def(&it)?.into(),
            ast::Trait(it) => sema.to_def(&it)?.into(),
            ast::Const(it) => sema.to_def(&it)?.into(),
            ast::Static(it) => sema.to_def(&it)?.into(),
            ast::TypeAlias(it) => sema.to_def(&it)?.into(),
            _ => return None,
        }
    };
    Some(Definition::ModuleDef(res))
}
pub ( crate ) fn doc_owner_to_def ( sema : & Semantics < RootDatabase > , item : SyntaxNode , ) -> Option < Definition > { let res : hir :: ModuleDef = match_ast ! { match item { ast SourceFile ( _it ) sema scope ( item ) module ( ) into ( ) ast Fn ( it ) sema to_def ( it ) into ( ) ast Struct ( it ) sema to_def ( it ) into ( ) ast Enum ( it ) sema to_def ( it ) into ( ) ast Union ( it ) sema to_def ( it ) into ( ) ast Trait ( it ) sema to_def ( it ) into ( ) ast Const ( it ) sema to_def ( it ) into ( ) ast Static ( it ) sema to_def ( it ) into ( ) ast TypeAlias ( it ) sema to_def ( it ) into ( ) return None } } ; Some ( Definition :: ModuleDef ( res ) ) }
FIXME: figure out a proper API here.
FIXME : figure out a proper API here .
sema
&Semantics<RootDatabase>
item
SyntaxNode
sema
&Semantics<RootDatabase>
item
SyntaxNode