mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
remove underscores
This commit is contained in:
parent
f14902f67b
commit
90bc832b22
5 changed files with 22 additions and 22 deletions
|
@ -25,37 +25,37 @@ pub(crate) trait HirDatabase: SyntaxDatabase + IdDatabase {
|
||||||
use fn crate::hir::function::imp::fn_scopes;
|
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;
|
type FileItemsQuery;
|
||||||
storage dependencies;
|
storage dependencies;
|
||||||
use fn crate::hir::module::nameres::file_items;
|
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;
|
type FileItemQuery;
|
||||||
storage dependencies;
|
storage dependencies;
|
||||||
use fn crate::hir::module::nameres::file_item;
|
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;
|
type InputModuleItemsQuery;
|
||||||
use fn crate::hir::module::nameres::input_module_items;
|
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;
|
type ItemMapQuery;
|
||||||
use fn crate::hir::module::nameres::item_map;
|
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;
|
type ModuleTreeQuery;
|
||||||
use fn crate::hir::module::imp::module_tree;
|
use fn crate::hir::module::imp::module_tree;
|
||||||
}
|
}
|
||||||
fn _fn_syntax(fn_id: FnId) -> FnDefNode {
|
fn fn_syntax(fn_id: FnId) -> FnDefNode {
|
||||||
type FnSyntaxQuery;
|
type FnSyntaxQuery;
|
||||||
// Don't retain syntax trees in memory
|
// Don't retain syntax trees in memory
|
||||||
storage dependencies;
|
storage dependencies;
|
||||||
use fn crate::hir::function::imp::fn_syntax;
|
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;
|
type SubmodulesQuery;
|
||||||
use fn crate::hir::module::imp::submodules;
|
use fn crate::hir::module::imp::submodules;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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> {
|
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());
|
let res = FnScopes::new(syntax.borrowed());
|
||||||
Arc::new(res)
|
Arc::new(res)
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ fn build_subtree(
|
||||||
parent,
|
parent,
|
||||||
children: Vec::new(),
|
children: Vec::new(),
|
||||||
});
|
});
|
||||||
for sub in db._submodules(source)?.iter() {
|
for sub in db.submodules(source)?.iter() {
|
||||||
let link = tree.push_link(LinkData {
|
let link = tree.push_link(LinkData {
|
||||||
name: sub.name().clone(),
|
name: sub.name().clone(),
|
||||||
owner: id,
|
owner: id,
|
||||||
|
|
|
@ -64,7 +64,7 @@ impl ModuleDescriptor {
|
||||||
module_source: ModuleSource,
|
module_source: ModuleSource,
|
||||||
) -> Cancelable<Option<ModuleDescriptor>> {
|
) -> Cancelable<Option<ModuleDescriptor>> {
|
||||||
let source_root_id = db.file_source_root(file_id);
|
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) {
|
let res = match module_tree.any_module_for_source(module_source) {
|
||||||
None => None,
|
None => None,
|
||||||
|
@ -82,7 +82,7 @@ impl ModuleDescriptor {
|
||||||
source_root_id: SourceRootId,
|
source_root_id: SourceRootId,
|
||||||
module_id: ModuleId,
|
module_id: ModuleId,
|
||||||
) -> Cancelable<ModuleDescriptor> {
|
) -> Cancelable<ModuleDescriptor> {
|
||||||
let module_tree = db._module_tree(source_root_id)?;
|
let module_tree = db.module_tree(source_root_id)?;
|
||||||
let res = ModuleDescriptor {
|
let res = ModuleDescriptor {
|
||||||
tree: module_tree,
|
tree: module_tree,
|
||||||
source_root_id,
|
source_root_id,
|
||||||
|
@ -148,7 +148,7 @@ impl ModuleDescriptor {
|
||||||
|
|
||||||
/// Returns a `ModuleScope`: a set of items, visible in this module.
|
/// Returns a `ModuleScope`: a set of items, visible in this module.
|
||||||
pub(crate) fn scope(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> {
|
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();
|
let res = item_map.per_module[&self.module_id].clone();
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub(crate) fn file_item(
|
||||||
file_id: FileId,
|
file_id: FileId,
|
||||||
file_item_id: FileItemId,
|
file_item_id: FileItemId,
|
||||||
) -> SyntaxNode {
|
) -> 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
|
/// Item map is the result of the name resolution. Item map contains, for each
|
||||||
|
@ -155,7 +155,7 @@ pub(crate) struct NamedImport {
|
||||||
|
|
||||||
impl NamedImport {
|
impl NamedImport {
|
||||||
pub(crate) fn range(&self, db: &impl HirDatabase, file_id: FileId) -> TextRange {
|
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();
|
let offset = syntax.borrowed().range().start();
|
||||||
self.relative_range + offset
|
self.relative_range + offset
|
||||||
}
|
}
|
||||||
|
@ -172,9 +172,9 @@ pub(crate) fn input_module_items(
|
||||||
source_root: SourceRootId,
|
source_root: SourceRootId,
|
||||||
module_id: ModuleId,
|
module_id: ModuleId,
|
||||||
) -> Cancelable<Arc<InputModuleItems>> {
|
) -> 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 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) {
|
let res = match source.resolve(db) {
|
||||||
ModuleSourceNode::SourceFile(it) => {
|
ModuleSourceNode::SourceFile(it) => {
|
||||||
let items = it.borrowed().items();
|
let items = it.borrowed().items();
|
||||||
|
@ -197,11 +197,11 @@ pub(crate) fn item_map(
|
||||||
source_root: SourceRootId,
|
source_root: SourceRootId,
|
||||||
) -> Cancelable<Arc<ItemMap>> {
|
) -> Cancelable<Arc<ItemMap>> {
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
let module_tree = db._module_tree(source_root)?;
|
let module_tree = db.module_tree(source_root)?;
|
||||||
let input = module_tree
|
let input = module_tree
|
||||||
.modules()
|
.modules()
|
||||||
.map(|id| {
|
.map(|id| {
|
||||||
let items = db._input_module_items(source_root, id)?;
|
let items = db.input_module_items(source_root, id)?;
|
||||||
Ok((id, items))
|
Ok((id, items))
|
||||||
})
|
})
|
||||||
.collect::<Cancelable<FxHashMap<_, _>>>()?;
|
.collect::<Cancelable<FxHashMap<_, _>>>()?;
|
||||||
|
@ -460,7 +460,7 @@ mod tests {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let module_id = descr.module_id;
|
let module_id = descr.module_id;
|
||||||
(db._item_map(source_root).unwrap(), module_id)
|
(db.item_map(source_root).unwrap(), module_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -513,9 +513,9 @@ mod tests {
|
||||||
{
|
{
|
||||||
let db = host.analysis().imp.db;
|
let db = host.analysis().imp.db;
|
||||||
let events = db.log_executed(|| {
|
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();
|
let mut change = AnalysisChange::new();
|
||||||
|
@ -537,7 +537,7 @@ mod tests {
|
||||||
{
|
{
|
||||||
let db = host.analysis().imp.db;
|
let db = host.analysis().imp.db;
|
||||||
let events = db.log_executed(|| {
|
let events = db.log_executed(|| {
|
||||||
db._item_map(source_root).unwrap();
|
db.item_map(source_root).unwrap();
|
||||||
});
|
});
|
||||||
assert!(
|
assert!(
|
||||||
!format!("{:?}", events).contains("_item_map"),
|
!format!("{:?}", events).contains("_item_map"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue