mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
remove Cancelable from adt API
This commit is contained in:
parent
05149d3532
commit
9446be2999
8 changed files with 41 additions and 58 deletions
|
@ -29,7 +29,7 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty)
|
|||
Ty::Adt { def_id, .. } => {
|
||||
match def_id.resolve(ctx.db)? {
|
||||
Def::Struct(s) => {
|
||||
for field in s.fields(ctx.db)? {
|
||||
for field in s.fields(ctx.db) {
|
||||
CompletionItem::new(
|
||||
CompletionKind::Reference,
|
||||
field.name().to_string(),
|
||||
|
|
|
@ -22,7 +22,7 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) -> C
|
|||
}
|
||||
}
|
||||
hir::Def::Enum(e) => {
|
||||
e.variants(ctx.db)?
|
||||
e.variants(ctx.db)
|
||||
.into_iter()
|
||||
.for_each(|(variant_name, _variant)| {
|
||||
CompletionItem::new(CompletionKind::Reference, variant_name.to_string())
|
||||
|
|
|
@ -112,15 +112,15 @@ impl NavigationTarget {
|
|||
pub(crate) fn from_def(db: &RootDatabase, def: Def) -> Cancelable<Option<NavigationTarget>> {
|
||||
let res = match def {
|
||||
Def::Struct(s) => {
|
||||
let (file_id, node) = s.source(db)?;
|
||||
let (file_id, node) = s.source(db);
|
||||
NavigationTarget::from_named(file_id.original_file(db), &*node)
|
||||
}
|
||||
Def::Enum(e) => {
|
||||
let (file_id, node) = e.source(db)?;
|
||||
let (file_id, node) = e.source(db);
|
||||
NavigationTarget::from_named(file_id.original_file(db), &*node)
|
||||
}
|
||||
Def::EnumVariant(ev) => {
|
||||
let (file_id, node) = ev.source(db)?;
|
||||
let (file_id, node) = ev.source(db);
|
||||
NavigationTarget::from_named(file_id.original_file(db), &*node)
|
||||
}
|
||||
Def::Function(f) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue