chore: Fix several style lints (#17488)
It's not comprehensive enough to start linting on `style` group, but hey, it's a start. Release Notes: - N/A
This commit is contained in:
parent
93249fc82b
commit
e6c1c51b37
361 changed files with 3530 additions and 3587 deletions
|
@ -269,7 +269,7 @@ impl TerminalElement {
|
|||
cur_rect = Some(LayoutRect::new(
|
||||
AlacPoint::new(line_index as i32, cell.point.column.0 as i32),
|
||||
1,
|
||||
convert_color(&bg, &theme),
|
||||
convert_color(&bg, theme),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ impl TerminalElement {
|
|||
hyperlink: Option<(HighlightStyle, &RangeInclusive<AlacPoint>)>,
|
||||
) -> TextRun {
|
||||
let flags = indexed.cell.flags;
|
||||
let mut fg = convert_color(&fg, &colors);
|
||||
let mut fg = convert_color(&fg, colors);
|
||||
|
||||
// Ghostty uses (175/255) as the multiplier (~0.69), Alacritty uses 0.66, Kitty
|
||||
// uses 0.75. We're using 0.7 because it's pretty well in the middle of that.
|
||||
|
@ -439,7 +439,7 @@ impl TerminalElement {
|
|||
move |e, cx| {
|
||||
cx.focus(&focus);
|
||||
terminal.update(cx, |terminal, cx| {
|
||||
terminal.mouse_down(&e, origin, cx);
|
||||
terminal.mouse_down(e, origin, cx);
|
||||
cx.notify();
|
||||
})
|
||||
}
|
||||
|
@ -460,18 +460,16 @@ impl TerminalElement {
|
|||
if terminal.selection_started() {
|
||||
terminal.mouse_drag(e, origin, hitbox.bounds);
|
||||
cx.notify();
|
||||
} else {
|
||||
if hovered {
|
||||
terminal.mouse_drag(e, origin, hitbox.bounds);
|
||||
cx.notify();
|
||||
}
|
||||
} else if hovered {
|
||||
terminal.mouse_drag(e, origin, hitbox.bounds);
|
||||
cx.notify();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if hitbox.is_hovered(cx) {
|
||||
terminal.update(cx, |terminal, cx| {
|
||||
terminal.mouse_move(&e, origin);
|
||||
terminal.mouse_move(e, origin);
|
||||
cx.notify();
|
||||
})
|
||||
}
|
||||
|
@ -485,7 +483,7 @@ impl TerminalElement {
|
|||
origin,
|
||||
focus.clone(),
|
||||
move |terminal, origin, e, cx| {
|
||||
terminal.mouse_up(&e, origin, cx);
|
||||
terminal.mouse_up(e, origin, cx);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -496,7 +494,7 @@ impl TerminalElement {
|
|||
origin,
|
||||
focus.clone(),
|
||||
move |terminal, origin, e, cx| {
|
||||
terminal.mouse_down(&e, origin, cx);
|
||||
terminal.mouse_down(e, origin, cx);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -522,7 +520,7 @@ impl TerminalElement {
|
|||
origin,
|
||||
focus.clone(),
|
||||
move |terminal, origin, e, cx| {
|
||||
terminal.mouse_down(&e, origin, cx);
|
||||
terminal.mouse_down(e, origin, cx);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -533,7 +531,7 @@ impl TerminalElement {
|
|||
origin,
|
||||
focus.clone(),
|
||||
move |terminal, origin, e, cx| {
|
||||
terminal.mouse_up(&e, origin, cx);
|
||||
terminal.mouse_up(e, origin, cx);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -544,7 +542,7 @@ impl TerminalElement {
|
|||
origin,
|
||||
focus,
|
||||
move |terminal, origin, e, cx| {
|
||||
terminal.mouse_up(&e, origin, cx);
|
||||
terminal.mouse_up(e, origin, cx);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -591,9 +589,8 @@ impl Element for TerminalElement {
|
|||
style.size.width = relative(1.).into();
|
||||
style.size.height = relative(1.).into();
|
||||
// style.overflow = point(Overflow::Hidden, Overflow::Hidden);
|
||||
let layout_id = cx.request_layout(style, None);
|
||||
|
||||
layout_id
|
||||
cx.request_layout(style, None)
|
||||
});
|
||||
(layout_id, ())
|
||||
}
|
||||
|
@ -625,7 +622,7 @@ impl Element for TerminalElement {
|
|||
.font_fallbacks
|
||||
.as_ref()
|
||||
.or(settings.buffer_font.fallbacks.as_ref())
|
||||
.map(|fallbacks| fallbacks.clone());
|
||||
.cloned();
|
||||
|
||||
let font_features = terminal_settings
|
||||
.font_features
|
||||
|
@ -758,7 +755,7 @@ impl Element for TerminalElement {
|
|||
let (cells, rects) = TerminalElement::layout_grid(
|
||||
cells.iter().cloned(),
|
||||
&text_style,
|
||||
&cx.text_system(),
|
||||
cx.text_system(),
|
||||
last_hovered_word
|
||||
.as_ref()
|
||||
.map(|last_hovered_word| (link_style, &last_hovered_word.word_match)),
|
||||
|
@ -926,7 +923,7 @@ impl Element for TerminalElement {
|
|||
layout.relative_highlighted_ranges.iter()
|
||||
{
|
||||
if let Some((start_y, highlighted_range_lines)) =
|
||||
to_highlighted_range_lines(relative_highlighted_range, &layout, origin)
|
||||
to_highlighted_range_lines(relative_highlighted_range, layout, origin)
|
||||
{
|
||||
let hr = HighlightedRange {
|
||||
start_y,
|
||||
|
@ -1069,7 +1066,7 @@ pub fn is_blank(cell: &IndexedCell) -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
true
|
||||
}
|
||||
|
||||
fn to_highlighted_range_lines(
|
||||
|
|
|
@ -786,9 +786,9 @@ impl Panel for TerminalPanel {
|
|||
let settings = TerminalSettings::get_global(cx);
|
||||
match self.position(cx) {
|
||||
DockPosition::Left | DockPosition::Right => {
|
||||
self.width.unwrap_or_else(|| settings.default_width)
|
||||
self.width.unwrap_or(settings.default_width)
|
||||
}
|
||||
DockPosition::Bottom => self.height.unwrap_or_else(|| settings.default_height),
|
||||
DockPosition::Bottom => self.height.unwrap_or(settings.default_height),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -886,9 +886,9 @@ fn retrieve_system_shell() -> Option<String> {
|
|||
use anyhow::Context;
|
||||
use util::ResultExt;
|
||||
|
||||
return std::env::var("SHELL")
|
||||
std::env::var("SHELL")
|
||||
.context("Error finding SHELL in env.")
|
||||
.log_err();
|
||||
.log_err()
|
||||
}
|
||||
// `alacritty_terminal` uses this as default on Windows. See:
|
||||
// https://github.com/alacritty/alacritty/blob/0d4ab7bca43213d96ddfe40048fc0f922543c6f8/alacritty_terminal/src/tty/windows/mod.rs#L130
|
||||
|
|
|
@ -645,7 +645,7 @@ fn subscribe_for_terminal_events(
|
|||
&path_like_target.maybe_path,
|
||||
cx,
|
||||
);
|
||||
smol::block_on(valid_files_to_open_task).len() > 0
|
||||
!smol::block_on(valid_files_to_open_task).is_empty()
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
@ -867,7 +867,7 @@ pub fn regex_search_for_query(query: &project::search::SearchQuery) -> Option<Re
|
|||
if query == "." {
|
||||
return None;
|
||||
}
|
||||
let searcher = RegexSearch::new(&query);
|
||||
let searcher = RegexSearch::new(query);
|
||||
searcher.ok()
|
||||
}
|
||||
|
||||
|
@ -1239,7 +1239,7 @@ impl SearchableItem for TerminalView {
|
|||
let searcher = match &*query {
|
||||
SearchQuery::Text { .. } => regex_search_for_query(
|
||||
&(SearchQuery::text(
|
||||
regex_to_literal(&query.as_str()),
|
||||
regex_to_literal(query.as_str()),
|
||||
query.whole_word(),
|
||||
query.case_sensitive(),
|
||||
query.include_ignored(),
|
||||
|
@ -1269,7 +1269,7 @@ impl SearchableItem for TerminalView {
|
|||
// Selection head might have a value if there's a selection that isn't
|
||||
// associated with a match. Therefore, if there are no matches, we should
|
||||
// report None, no matter the state of the terminal
|
||||
let res = if matches.len() > 0 {
|
||||
let res = if !matches.is_empty() {
|
||||
if let Some(selection_head) = self.terminal().read(cx).selection_head {
|
||||
// If selection head is contained in a match. Return that match
|
||||
if let Some(ix) = matches
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue