Skip to content

Commit 2724b35

Browse files
committed
less wordy ref_kind assignment
1 parent 053ae24 commit 2724b35

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

crates/ide_assists/src/handlers/extract_variable.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,10 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext) -> Option
5252
}
5353
}
5454

55-
let ref_kind: RefKind = if let Some(receiver_type) = get_receiver_type(&ctx, &to_extract) {
56-
if receiver_type.is_mutable_reference() {
57-
RefKind::MutRef
58-
} else if receiver_type.is_reference() {
59-
RefKind::Ref
60-
} else {
61-
RefKind::None
62-
}
63-
} else {
64-
RefKind::None
55+
let ref_kind = match get_receiver_type(&ctx, &to_extract) {
56+
Some(receiver_type) if receiver_type.is_mutable_reference() => RefKind::MutRef,
57+
Some(receiver_type) if receiver_type.is_reference() => RefKind::Ref,
58+
_ => RefKind::None,
6559
};
6660

6761
let anchor = Anchor::from(&to_extract)?;

0 commit comments

Comments
 (0)