mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Fix some tests
This commit is contained in:
parent
582cee2cdf
commit
d386481fac
4 changed files with 143 additions and 49 deletions
|
@ -2,11 +2,19 @@
|
|||
pub mod insert_use;
|
||||
pub mod import_assets;
|
||||
|
||||
use hir::{Crate, Enum, Module, ScopeDef, Semantics, Trait};
|
||||
use hir::{Crate, Enum, ItemInNs, MacroDef, Module, ModuleDef, Name, ScopeDef, Semantics, Trait};
|
||||
use syntax::ast::{self, make};
|
||||
|
||||
use crate::RootDatabase;
|
||||
|
||||
pub fn item_name(db: &RootDatabase, item: ItemInNs) -> Option<Name> {
|
||||
match item {
|
||||
ItemInNs::Types(module_def_id) => ModuleDef::from(module_def_id).name(db),
|
||||
ItemInNs::Values(module_def_id) => ModuleDef::from(module_def_id).name(db),
|
||||
ItemInNs::Macros(macro_def_id) => MacroDef::from(macro_def_id).name(db),
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts the mod path struct into its ast representation.
|
||||
pub fn mod_path_to_ast(path: &hir::ModPath) -> ast::Path {
|
||||
let _p = profile::span("mod_path_to_ast");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue