mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Simplify trait resolution fragment
This commit is contained in:
parent
0e47c371fd
commit
b3742873d9
@ -49,13 +49,10 @@ pub(crate) fn add_missing_impl_members(mut ctx: AssistCtx<impl HirDatabase>) ->
|
|||||||
}
|
}
|
||||||
|
|
||||||
let trait_def = {
|
let trait_def = {
|
||||||
let db = ctx.db;
|
let position = FilePosition { file_id: ctx.frange.file_id, offset: node.range().end() };
|
||||||
// TODO: Can we get the position of cursor itself rather than supplied range?
|
let resolver = hir::source_binder::resolver_for_position(ctx.db, position);
|
||||||
let range = ctx.frange;
|
|
||||||
let position = FilePosition { file_id: range.file_id, offset: range.range.start() };
|
|
||||||
let resolver = hir::source_binder::resolver_for_position(db, position);
|
|
||||||
|
|
||||||
resolve_target_trait_def(db, &resolver, impl_node)?
|
resolve_target_trait_def(ctx.db, &resolver, impl_node)?
|
||||||
};
|
};
|
||||||
|
|
||||||
let fn_def_opt = |kind| if let ImplItemKind::FnDef(def) = kind { Some(def) } else { None };
|
let fn_def_opt = |kind| if let ImplItemKind::FnDef(def) = kind { Some(def) } else { None };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user