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

Loading…
Cancel
Save