mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
less wordy ref_kind assignment
This commit is contained in:
parent
053ae2452c
commit
2724b35490
1 changed files with 4 additions and 10 deletions
|
@ -52,16 +52,10 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext) -> Option
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let ref_kind: RefKind = if let Some(receiver_type) = get_receiver_type(&ctx, &to_extract) {
|
let ref_kind = match get_receiver_type(&ctx, &to_extract) {
|
||||||
if receiver_type.is_mutable_reference() {
|
Some(receiver_type) if receiver_type.is_mutable_reference() => RefKind::MutRef,
|
||||||
RefKind::MutRef
|
Some(receiver_type) if receiver_type.is_reference() => RefKind::Ref,
|
||||||
} else if receiver_type.is_reference() {
|
_ => RefKind::None,
|
||||||
RefKind::Ref
|
|
||||||
} else {
|
|
||||||
RefKind::None
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
RefKind::None
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let anchor = Anchor::from(&to_extract)?;
|
let anchor = Anchor::from(&to_extract)?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue