remove underscores

This commit is contained in:
Aleksey Kladov 2018-11-27 23:05:33 +03:00
parent f14902f67b
commit 90bc832b22
5 changed files with 22 additions and 22 deletions

View File

@ -25,37 +25,37 @@ pub(crate) trait HirDatabase: SyntaxDatabase + IdDatabase {
use fn crate::hir::function::imp::fn_scopes;
}
fn _file_items(file_id: FileId) -> Arc<FileItems> {
fn file_items(file_id: FileId) -> Arc<FileItems> {
type FileItemsQuery;
storage dependencies;
use fn crate::hir::module::nameres::file_items;
}
fn _file_item(file_id: FileId, file_item_id: FileItemId) -> SyntaxNode {
fn file_item(file_id: FileId, file_item_id: FileItemId) -> SyntaxNode {
type FileItemQuery;
storage dependencies;
use fn crate::hir::module::nameres::file_item;
}
fn _input_module_items(source_root_id: SourceRootId, module_id: ModuleId) -> Cancelable<Arc<InputModuleItems>> {
fn input_module_items(source_root_id: SourceRootId, module_id: ModuleId) -> Cancelable<Arc<InputModuleItems>> {
type InputModuleItemsQuery;
use fn crate::hir::module::nameres::input_module_items;
}
fn _item_map(source_root_id: SourceRootId) -> Cancelable<Arc<ItemMap>> {
fn item_map(source_root_id: SourceRootId) -> Cancelable<Arc<ItemMap>> {
type ItemMapQuery;
use fn crate::hir::module::nameres::item_map;
}
fn _module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> {
fn module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> {
type ModuleTreeQuery;
use fn crate::hir::module::imp::module_tree;
}
fn _fn_syntax(fn_id: FnId) -> FnDefNode {
fn fn_syntax(fn_id: FnId) -> FnDefNode {
type FnSyntaxQuery;
// Don't retain syntax trees in memory
storage dependencies;
use fn crate::hir::function::imp::fn_syntax;
}
fn _submodules(source: ModuleSource) -> Cancelable<Arc<Vec<crate::hir::module::imp::Submodule>>> {
fn submodules(source: ModuleSource) -> Cancelable<Arc<Vec<crate::hir::module::imp::Submodule>>> {
type SubmodulesQuery;
use fn crate::hir::module::imp::submodules;
}

View File

@ -15,7 +15,7 @@ pub(crate) fn fn_syntax(db: &impl HirDatabase, fn_id: FnId) -> FnDefNode {
}
pub(crate) fn fn_scopes(db: &impl HirDatabase, fn_id: FnId) -> Arc<FnScopes> {
let syntax = db._fn_syntax(fn_id);
let syntax = db.fn_syntax(fn_id);
let res = FnScopes::new(syntax.borrowed());
Arc::new(res)
}

View File

@ -135,7 +135,7 @@ fn build_subtree(
parent,
children: Vec::new(),
});
for sub in db._submodules(source)?.iter() {
for sub in db.submodules(source)?.iter() {
let link = tree.push_link(LinkData {
name: sub.name().clone(),
owner: id,

View File

@ -64,7 +64,7 @@ impl ModuleDescriptor {
module_source: ModuleSource,
) -> Cancelable<Option<ModuleDescriptor>> {
let source_root_id = db.file_source_root(file_id);
let module_tree = db._module_tree(source_root_id)?;
let module_tree = db.module_tree(source_root_id)?;
let res = match module_tree.any_module_for_source(module_source) {
None => None,
@ -82,7 +82,7 @@ impl ModuleDescriptor {
source_root_id: SourceRootId,
module_id: ModuleId,
) -> Cancelable<ModuleDescriptor> {
let module_tree = db._module_tree(source_root_id)?;
let module_tree = db.module_tree(source_root_id)?;
let res = ModuleDescriptor {
tree: module_tree,
source_root_id,
@ -148,7 +148,7 @@ impl ModuleDescriptor {
/// Returns a `ModuleScope`: a set of items, visible in this module.
pub(crate) fn scope(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> {
let item_map = db._item_map(self.source_root_id)?;
let item_map = db.item_map(self.source_root_id)?;
let res = item_map.per_module[&self.module_id].clone();
Ok(res)
}

View File

@ -91,7 +91,7 @@ pub(crate) fn file_item(
file_id: FileId,
file_item_id: FileItemId,
) -> SyntaxNode {
db._file_items(file_id)[file_item_id].clone()
db.file_items(file_id)[file_item_id].clone()
}
/// Item map is the result of the name resolution. Item map contains, for each
@ -155,7 +155,7 @@ pub(crate) struct NamedImport {
impl NamedImport {
pub(crate) fn range(&self, db: &impl HirDatabase, file_id: FileId) -> TextRange {
let syntax = db._file_item(file_id, self.file_item_id);
let syntax = db.file_item(file_id, self.file_item_id);
let offset = syntax.borrowed().range().start();
self.relative_range + offset
}
@ -172,9 +172,9 @@ pub(crate) fn input_module_items(
source_root: SourceRootId,
module_id: ModuleId,
) -> Cancelable<Arc<InputModuleItems>> {
let module_tree = db._module_tree(source_root)?;
let module_tree = db.module_tree(source_root)?;
let source = module_id.source(&module_tree);
let file_items = db._file_items(source.file_id());
let file_items = db.file_items(source.file_id());
let res = match source.resolve(db) {
ModuleSourceNode::SourceFile(it) => {
let items = it.borrowed().items();
@ -197,11 +197,11 @@ pub(crate) fn item_map(
source_root: SourceRootId,
) -> Cancelable<Arc<ItemMap>> {
let start = Instant::now();
let module_tree = db._module_tree(source_root)?;
let module_tree = db.module_tree(source_root)?;
let input = module_tree
.modules()
.map(|id| {
let items = db._input_module_items(source_root, id)?;
let items = db.input_module_items(source_root, id)?;
Ok((id, items))
})
.collect::<Cancelable<FxHashMap<_, _>>>()?;
@ -460,7 +460,7 @@ mod tests {
.unwrap()
.unwrap();
let module_id = descr.module_id;
(db._item_map(source_root).unwrap(), module_id)
(db.item_map(source_root).unwrap(), module_id)
}
#[test]
@ -513,9 +513,9 @@ mod tests {
{
let db = host.analysis().imp.db;
let events = db.log_executed(|| {
db._item_map(source_root).unwrap();
db.item_map(source_root).unwrap();
});
assert!(format!("{:?}", events).contains("_item_map"))
assert!(format!("{:?}", events).contains("item_map"))
}
let mut change = AnalysisChange::new();
@ -537,7 +537,7 @@ mod tests {
{
let db = host.analysis().imp.db;
let events = db.log_executed(|| {
db._item_map(source_root).unwrap();
db.item_map(source_root).unwrap();
});
assert!(
!format!("{:?}", events).contains("_item_map"),