Auto-fix clippy::collapsible_if violations (#36428)
Release Notes: - N/A
This commit is contained in:
parent
9e8ec72bd5
commit
8f567383e4
281 changed files with 6628 additions and 7089 deletions
|
@ -98,12 +98,12 @@ pub fn highlight_ranges(
|
|||
|
||||
loop {
|
||||
end_ix = end_ix + text[end_ix..].chars().next().unwrap().len_utf8();
|
||||
if let Some(&next_ix) = highlight_indices.peek() {
|
||||
if next_ix == end_ix {
|
||||
end_ix = next_ix;
|
||||
highlight_indices.next();
|
||||
continue;
|
||||
}
|
||||
if let Some(&next_ix) = highlight_indices.peek()
|
||||
&& next_ix == end_ix
|
||||
{
|
||||
end_ix = next_ix;
|
||||
highlight_indices.next();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -72,10 +72,10 @@ impl<M: ManagedView> PopoverMenuHandle<M> {
|
|||
}
|
||||
|
||||
pub fn hide(&self, cx: &mut App) {
|
||||
if let Some(state) = self.0.borrow().as_ref() {
|
||||
if let Some(menu) = state.menu.borrow().as_ref() {
|
||||
menu.update(cx, |_, cx| cx.emit(DismissEvent));
|
||||
}
|
||||
if let Some(state) = self.0.borrow().as_ref()
|
||||
&& let Some(menu) = state.menu.borrow().as_ref()
|
||||
{
|
||||
menu.update(cx, |_, cx| cx.emit(DismissEvent));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,10 +278,10 @@ fn show_menu<M: ManagedView>(
|
|||
|
||||
window
|
||||
.subscribe(&new_menu, cx, move |modal, _: &DismissEvent, window, cx| {
|
||||
if modal.focus_handle(cx).contains_focused(window, cx) {
|
||||
if let Some(previous_focus_handle) = previous_focus_handle.as_ref() {
|
||||
window.focus(previous_focus_handle);
|
||||
}
|
||||
if modal.focus_handle(cx).contains_focused(window, cx)
|
||||
&& let Some(previous_focus_handle) = previous_focus_handle.as_ref()
|
||||
{
|
||||
window.focus(previous_focus_handle);
|
||||
}
|
||||
*menu2.borrow_mut() = None;
|
||||
window.refresh();
|
||||
|
@ -373,14 +373,14 @@ impl<M: ManagedView> Element for PopoverMenu<M> {
|
|||
(child_builder)(element_state.menu.clone(), self.menu_builder.clone())
|
||||
});
|
||||
|
||||
if let Some(trigger_handle) = self.trigger_handle.take() {
|
||||
if let Some(menu_builder) = self.menu_builder.clone() {
|
||||
*trigger_handle.0.borrow_mut() = Some(PopoverMenuHandleState {
|
||||
menu_builder,
|
||||
menu: element_state.menu.clone(),
|
||||
on_open: self.on_open.clone(),
|
||||
});
|
||||
}
|
||||
if let Some(trigger_handle) = self.trigger_handle.take()
|
||||
&& let Some(menu_builder) = self.menu_builder.clone()
|
||||
{
|
||||
*trigger_handle.0.borrow_mut() = Some(PopoverMenuHandleState {
|
||||
menu_builder,
|
||||
menu: element_state.menu.clone(),
|
||||
on_open: self.on_open.clone(),
|
||||
});
|
||||
}
|
||||
|
||||
let child_layout_id = child_element
|
||||
|
|
|
@ -250,12 +250,11 @@ impl<M: ManagedView> Element for RightClickMenu<M> {
|
|||
|
||||
window
|
||||
.subscribe(&new_menu, cx, move |modal, _: &DismissEvent, window, cx| {
|
||||
if modal.focus_handle(cx).contains_focused(window, cx) {
|
||||
if let Some(previous_focus_handle) =
|
||||
if modal.focus_handle(cx).contains_focused(window, cx)
|
||||
&& let Some(previous_focus_handle) =
|
||||
previous_focus_handle.as_ref()
|
||||
{
|
||||
window.focus(previous_focus_handle);
|
||||
}
|
||||
{
|
||||
window.focus(previous_focus_handle);
|
||||
}
|
||||
*menu2.borrow_mut() = None;
|
||||
window.refresh();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue