Enable clippy::unnecessary_unwrap (#8756)
This PR enables the [`clippy::unnecessary_unwrap`](https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_unwrap) rule and fixes the outstanding violations. Release Notes: - N/A
This commit is contained in:
@@ -51,8 +51,10 @@ impl<M: ManagedView> PopoverMenu<M> {
|
||||
|
||||
cx.subscribe(&new_menu, move |modal, _: &DismissEvent, cx| {
|
||||
if modal.focus_handle(cx).contains_focused(cx) {
|
||||
if previous_focus_handle.is_some() {
|
||||
cx.focus(previous_focus_handle.as_ref().unwrap())
|
||||
if let Some(previous_focus_handle) =
|
||||
previous_focus_handle.as_ref()
|
||||
{
|
||||
cx.focus(previous_focus_handle);
|
||||
}
|
||||
}
|
||||
*menu2.borrow_mut() = None;
|
||||
|
||||
@@ -154,8 +154,8 @@ impl<M: ManagedView> Element for RightClickMenu<M> {
|
||||
|
||||
cx.subscribe(&new_menu, move |modal, _: &DismissEvent, cx| {
|
||||
if modal.focus_handle(cx).contains_focused(cx) {
|
||||
if previous_focus_handle.is_some() {
|
||||
cx.focus(previous_focus_handle.as_ref().unwrap())
|
||||
if let Some(previous_focus_handle) = previous_focus_handle.as_ref() {
|
||||
cx.focus(previous_focus_handle);
|
||||
}
|
||||
}
|
||||
*menu2.borrow_mut() = None;
|
||||
@@ -165,11 +165,12 @@ impl<M: ManagedView> Element for RightClickMenu<M> {
|
||||
cx.focus_view(&new_menu);
|
||||
*menu.borrow_mut() = Some(new_menu);
|
||||
|
||||
*position.borrow_mut() = if attach.is_some() && child_layout_id.is_some() {
|
||||
attach.unwrap().corner(child_bounds)
|
||||
} else {
|
||||
cx.mouse_position()
|
||||
};
|
||||
*position.borrow_mut() =
|
||||
if let Some(attach) = attach.filter(|_| child_layout_id.is_some()) {
|
||||
attach.corner(child_bounds)
|
||||
} else {
|
||||
cx.mouse_position()
|
||||
};
|
||||
cx.refresh();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user