Fix a bunch of other low-hanging style lints (#36498)

- **Fix a bunch of low hanging style lints like unnecessary-return**
- **Fix single worktree violation**
- **And the rest**

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-19 21:26:17 +02:00 committed by GitHub
parent df9c2aefb1
commit 05fc0c432c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
239 changed files with 854 additions and 1015 deletions

View file

@ -235,12 +235,10 @@ fn adjust_lightness_for_contrast(
} else {
high = mid;
}
} else if should_go_darker {
high = mid;
} else {
if should_go_darker {
high = mid;
} else {
low = mid;
}
low = mid;
}
// If we're close enough to the target, stop

View file

@ -1478,7 +1478,7 @@ pub fn is_blank(cell: &IndexedCell) -> bool {
return false;
}
return true;
true
}
fn to_highlighted_range_lines(

View file

@ -350,12 +350,10 @@ impl TerminalPanel {
pane.set_zoomed(false, cx);
});
cx.emit(PanelEvent::Close);
} else {
if let Some(focus_on_pane) =
focus_on_pane.as_ref().or_else(|| self.center.panes().pop())
{
focus_on_pane.focus_handle(cx).focus(window);
}
} else if let Some(focus_on_pane) =
focus_on_pane.as_ref().or_else(|| self.center.panes().pop())
{
focus_on_pane.focus_handle(cx).focus(window);
}
}
pane::Event::ZoomIn => {
@ -896,9 +894,9 @@ impl TerminalPanel {
}
fn is_enabled(&self, cx: &App) -> bool {
self.workspace.upgrade().map_or(false, |workspace| {
is_enabled_in_workspace(workspace.read(cx), cx)
})
self.workspace
.upgrade()
.is_some_and(|workspace| is_enabled_in_workspace(workspace.read(cx), cx))
}
fn activate_pane_in_direction(
@ -1242,20 +1240,18 @@ impl Render for TerminalPanel {
let panes = terminal_panel.center.panes();
if let Some(&pane) = panes.get(action.0) {
window.focus(&pane.read(cx).focus_handle(cx));
} else {
if let Some(new_pane) =
terminal_panel.new_pane_with_cloned_active_terminal(window, cx)
{
terminal_panel
.center
.split(
&terminal_panel.active_pane,
&new_pane,
SplitDirection::Right,
)
.log_err();
window.focus(&new_pane.focus_handle(cx));
}
} else if let Some(new_pane) =
terminal_panel.new_pane_with_cloned_active_terminal(window, cx)
{
terminal_panel
.center
.split(
&terminal_panel.active_pane,
&new_pane,
SplitDirection::Right,
)
.log_err();
window.focus(&new_pane.focus_handle(cx));
}
}),
)

View file

@ -385,9 +385,7 @@ impl TerminalView {
.workspace
.upgrade()
.and_then(|workspace| workspace.read(cx).panel::<TerminalPanel>(cx))
.map_or(false, |terminal_panel| {
terminal_panel.read(cx).assistant_enabled()
});
.is_some_and(|terminal_panel| terminal_panel.read(cx).assistant_enabled());
let context_menu = ContextMenu::build(window, cx, |menu, _, _| {
menu.context(self.focus_handle.clone())
.action("New Terminal", Box::new(NewTerminal))