Replace if let with early return

imgbot
Gokul Soumya 3 years ago committed by Blaž Hrastnik
parent f0cd02d5ef
commit e90276df0b

@ -3494,7 +3494,10 @@ pub fn code_action(cx: &mut Context) {
move |editor: &mut Editor,
compositor: &mut Compositor,
response: Option<lsp::CodeActionResponse>| {
if let Some(actions) = response {
let actions = match response {
Some(a) => a,
None => return,
};
if actions.is_empty() {
editor.set_status("No code actions available".to_owned());
return;
@ -3528,13 +3531,11 @@ pub fn code_action(cx: &mut Context) {
}
}
});
let popup =
Popup::new("code-action", picker).margin(helix_view::graphics::Margin {
let popup = Popup::new("code-action", picker).margin(helix_view::graphics::Margin {
vertical: 1,
horizontal: 1,
});
compositor.push(Box::new(popup))
}
},
)
}

Loading…
Cancel
Save