mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
Cleanup inline
This commit is contained in:
parent
96c04c5e1c
commit
2e4a4f1a9c
@ -418,22 +418,15 @@ fn assoc_fn_target_info(
|
||||
adt: hir::Adt,
|
||||
fn_name: &str,
|
||||
) -> Option<TargetInfo> {
|
||||
let mut target_module = None;
|
||||
let mut adt_name = None;
|
||||
let (target, file, insert_offset) = {
|
||||
let target_module: &mut Option<Module> = &mut target_module;
|
||||
let adt_name: &mut Option<hir::Name> = &mut adt_name;
|
||||
let current_module = ctx.sema.scope(call.syntax())?.module();
|
||||
let module = adt.module(ctx.sema.db);
|
||||
*target_module = if current_module == module { None } else { Some(module) };
|
||||
if current_module.krate() != module.krate() {
|
||||
return None;
|
||||
}
|
||||
let (impl_, file) = get_adt_source(ctx, &adt, fn_name)?;
|
||||
let (target, insert_offset) = get_method_target(ctx, &module, &impl_)?;
|
||||
*adt_name = if impl_.is_none() { Some(adt.name(ctx.sema.db)) } else { None };
|
||||
Some((target, file, insert_offset))
|
||||
}?;
|
||||
let current_module = ctx.sema.scope(call.syntax())?.module();
|
||||
let module = adt.module(ctx.sema.db);
|
||||
let target_module = if current_module == module { None } else { Some(module) };
|
||||
if current_module.krate() != module.krate() {
|
||||
return None;
|
||||
}
|
||||
let (impl_, file) = get_adt_source(ctx, &adt, fn_name)?;
|
||||
let (target, insert_offset) = get_method_target(ctx, &module, &impl_)?;
|
||||
let adt_name = if impl_.is_none() { Some(adt.name(ctx.sema.db)) } else { None };
|
||||
Some(TargetInfo { target_module, adt_name, target, file, insert_offset })
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user