mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
remove Cancelable from nameres
This commit is contained in:
parent
18e9a710cd
commit
490112dea1
10 changed files with 52 additions and 66 deletions
|
@ -8,13 +8,13 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) -> C
|
|||
(Some(path), Some(module)) => (path.clone(), module),
|
||||
_ => return Ok(()),
|
||||
};
|
||||
let def_id = match module.resolve_path(ctx.db, &path)?.take_types() {
|
||||
let def_id = match module.resolve_path(ctx.db, &path).take_types() {
|
||||
Some(it) => it,
|
||||
None => return Ok(()),
|
||||
};
|
||||
match def_id.resolve(ctx.db) {
|
||||
hir::Def::Module(module) => {
|
||||
let module_scope = module.scope(ctx.db)?;
|
||||
let module_scope = module.scope(ctx.db);
|
||||
for (name, res) in module_scope.entries() {
|
||||
CompletionItem::new(CompletionKind::Reference, name.to_string())
|
||||
.from_resolution(ctx, res)
|
||||
|
|
|
@ -19,7 +19,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) ->
|
|||
complete_fn(acc, &scopes, ctx.offset);
|
||||
}
|
||||
|
||||
let module_scope = module.scope(ctx.db)?;
|
||||
let module_scope = module.scope(ctx.db);
|
||||
let (file_id, _) = module.definition_source(ctx.db);
|
||||
module_scope
|
||||
.entries()
|
||||
|
|
|
@ -85,7 +85,7 @@ pub(crate) fn reference_definition(
|
|||
.find_map(ast::Path::cast)
|
||||
.and_then(hir::Path::from_ast)
|
||||
{
|
||||
let resolved = module.resolve_path(db, &path)?;
|
||||
let resolved = module.resolve_path(db, &path);
|
||||
if let Some(def_id) = resolved.take_types().or(resolved.take_values()) {
|
||||
if let Some(target) = NavigationTarget::from_def(db, def_id.resolve(db)) {
|
||||
return Ok(Exact(target));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue