mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +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) {
|
||||
if receiver_type.is_mutable_reference() {
|
||||
RefKind::MutRef
|
||||
} else if receiver_type.is_reference() {
|
||||
RefKind::Ref
|
||||
} else {
|
||||
RefKind::None
|
||||
}
|
||||
} else {
|
||||
RefKind::None
|
||||
let ref_kind = match get_receiver_type(&ctx, &to_extract) {
|
||||
Some(receiver_type) if receiver_type.is_mutable_reference() => RefKind::MutRef,
|
||||
Some(receiver_type) if receiver_type.is_reference() => RefKind::Ref,
|
||||
_ => RefKind::None,
|
||||
};
|
||||
|
||||
let anchor = Anchor::from(&to_extract)?;
|
||||
|
|
Loading…
Reference in a new issue