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
|
@ -583,15 +583,15 @@ impl TerminalElement {
|
|||
strikethrough,
|
||||
};
|
||||
|
||||
if let Some((style, range)) = hyperlink {
|
||||
if range.contains(&indexed.point) {
|
||||
if let Some(underline) = style.underline {
|
||||
result.underline = Some(underline);
|
||||
}
|
||||
if let Some((style, range)) = hyperlink
|
||||
&& range.contains(&indexed.point)
|
||||
{
|
||||
if let Some(underline) = style.underline {
|
||||
result.underline = Some(underline);
|
||||
}
|
||||
|
||||
if let Some(color) = style.color {
|
||||
result.color = color;
|
||||
}
|
||||
if let Some(color) = style.color {
|
||||
result.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1275,9 +1275,9 @@ impl Element for TerminalElement {
|
|||
}
|
||||
let text_paint_time = text_paint_start.elapsed();
|
||||
|
||||
if let Some(text_to_mark) = &marked_text_cloned {
|
||||
if !text_to_mark.is_empty() {
|
||||
if let Some(cursor_layout) = &original_cursor {
|
||||
if let Some(text_to_mark) = &marked_text_cloned
|
||||
&& !text_to_mark.is_empty()
|
||||
&& let Some(cursor_layout) = &original_cursor {
|
||||
let ime_position = cursor_layout.bounding_rect(origin).origin;
|
||||
let mut ime_style = layout.base_text_style.clone();
|
||||
ime_style.underline = Some(UnderlineStyle {
|
||||
|
@ -1303,14 +1303,11 @@ impl Element for TerminalElement {
|
|||
.paint(ime_position, layout.dimensions.line_height, window, cx)
|
||||
.log_err();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if self.cursor_visible && marked_text_cloned.is_none() {
|
||||
if let Some(mut cursor) = original_cursor {
|
||||
if self.cursor_visible && marked_text_cloned.is_none()
|
||||
&& let Some(mut cursor) = original_cursor {
|
||||
cursor.paint(origin, window, cx);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(mut element) = block_below_cursor_element {
|
||||
element.paint(window, cx);
|
||||
|
|
|
@ -255,8 +255,7 @@ impl TerminalPanel {
|
|||
.transpose()
|
||||
.log_err()
|
||||
.flatten()
|
||||
{
|
||||
if let Ok(serialized) = workspace
|
||||
&& let Ok(serialized) = workspace
|
||||
.update_in(&mut cx, |workspace, window, cx| {
|
||||
deserialize_terminal_panel(
|
||||
workspace.weak_handle(),
|
||||
|
@ -268,9 +267,8 @@ impl TerminalPanel {
|
|||
)
|
||||
})?
|
||||
.await
|
||||
{
|
||||
terminal_panel = Some(serialized);
|
||||
}
|
||||
{
|
||||
terminal_panel = Some(serialized);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
|
@ -1077,11 +1075,10 @@ pub fn new_terminal_pane(
|
|||
return ControlFlow::Break(());
|
||||
}
|
||||
};
|
||||
} else if let Some(project_path) = item.project_path(cx) {
|
||||
if let Some(entry_path) = project.read(cx).absolute_path(&project_path, cx)
|
||||
{
|
||||
add_paths_to_terminal(pane, &[entry_path], window, cx);
|
||||
}
|
||||
} else if let Some(project_path) = item.project_path(cx)
|
||||
&& let Some(entry_path) = project.read(cx).absolute_path(&project_path, cx)
|
||||
{
|
||||
add_paths_to_terminal(pane, &[entry_path], window, cx);
|
||||
}
|
||||
}
|
||||
} else if let Some(selection) = dropped_item.downcast_ref::<DraggedSelection>() {
|
||||
|
@ -1103,10 +1100,8 @@ pub fn new_terminal_pane(
|
|||
{
|
||||
add_paths_to_terminal(pane, &[entry_path], window, cx);
|
||||
}
|
||||
} else if is_local {
|
||||
if let Some(paths) = dropped_item.downcast_ref::<ExternalPaths>() {
|
||||
add_paths_to_terminal(pane, paths.paths(), window, cx);
|
||||
}
|
||||
} else if is_local && let Some(paths) = dropped_item.downcast_ref::<ExternalPaths>() {
|
||||
add_paths_to_terminal(pane, paths.paths(), window, cx);
|
||||
}
|
||||
|
||||
ControlFlow::Break(())
|
||||
|
|
|
@ -308,10 +308,10 @@ impl TerminalView {
|
|||
} else {
|
||||
let mut displayed_lines = total_lines;
|
||||
|
||||
if !self.focus_handle.is_focused(window) {
|
||||
if let Some(max_lines) = max_lines_when_unfocused {
|
||||
displayed_lines = displayed_lines.min(*max_lines)
|
||||
}
|
||||
if !self.focus_handle.is_focused(window)
|
||||
&& let Some(max_lines) = max_lines_when_unfocused
|
||||
{
|
||||
displayed_lines = displayed_lines.min(*max_lines)
|
||||
}
|
||||
|
||||
ContentMode::Inline {
|
||||
|
@ -1156,26 +1156,26 @@ fn subscribe_for_terminal_events(
|
|||
|
||||
if let Some(opened_item) = opened_items.first() {
|
||||
if open_target.is_file() {
|
||||
if let Some(Ok(opened_item)) = opened_item {
|
||||
if let Some(row) = path_to_open.row {
|
||||
let col = path_to_open.column.unwrap_or(0);
|
||||
if let Some(active_editor) =
|
||||
opened_item.downcast::<Editor>()
|
||||
{
|
||||
active_editor
|
||||
.downgrade()
|
||||
.update_in(cx, |editor, window, cx| {
|
||||
editor.go_to_singleton_buffer_point(
|
||||
language::Point::new(
|
||||
row.saturating_sub(1),
|
||||
col.saturating_sub(1),
|
||||
),
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.log_err();
|
||||
}
|
||||
if let Some(Ok(opened_item)) = opened_item
|
||||
&& let Some(row) = path_to_open.row
|
||||
{
|
||||
let col = path_to_open.column.unwrap_or(0);
|
||||
if let Some(active_editor) =
|
||||
opened_item.downcast::<Editor>()
|
||||
{
|
||||
active_editor
|
||||
.downgrade()
|
||||
.update_in(cx, |editor, window, cx| {
|
||||
editor.go_to_singleton_buffer_point(
|
||||
language::Point::new(
|
||||
row.saturating_sub(1),
|
||||
col.saturating_sub(1),
|
||||
),
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.log_err();
|
||||
}
|
||||
}
|
||||
} else if open_target.is_dir() {
|
||||
|
@ -1321,17 +1321,17 @@ fn possible_open_target(
|
|||
}
|
||||
};
|
||||
|
||||
if path_to_check.path.is_relative() {
|
||||
if let Some(entry) = worktree.read(cx).entry_for_path(&path_to_check.path) {
|
||||
return Task::ready(Some(OpenTarget::Worktree(
|
||||
PathWithPosition {
|
||||
path: worktree_root.join(&entry.path),
|
||||
row: path_to_check.row,
|
||||
column: path_to_check.column,
|
||||
},
|
||||
entry.clone(),
|
||||
)));
|
||||
}
|
||||
if path_to_check.path.is_relative()
|
||||
&& let Some(entry) = worktree.read(cx).entry_for_path(&path_to_check.path)
|
||||
{
|
||||
return Task::ready(Some(OpenTarget::Worktree(
|
||||
PathWithPosition {
|
||||
path: worktree_root.join(&entry.path),
|
||||
row: path_to_check.row,
|
||||
column: path_to_check.column,
|
||||
},
|
||||
entry.clone(),
|
||||
)));
|
||||
}
|
||||
|
||||
paths_to_check.push(path_to_check);
|
||||
|
@ -1428,11 +1428,11 @@ fn possible_open_target(
|
|||
let fs = workspace.read(cx).project().read(cx).fs().clone();
|
||||
cx.background_spawn(async move {
|
||||
for mut path_to_check in fs_paths_to_check {
|
||||
if let Some(fs_path_to_check) = fs.canonicalize(&path_to_check.path).await.ok() {
|
||||
if let Some(metadata) = fs.metadata(&fs_path_to_check).await.ok().flatten() {
|
||||
path_to_check.path = fs_path_to_check;
|
||||
return Some(OpenTarget::File(path_to_check, metadata));
|
||||
}
|
||||
if let Some(fs_path_to_check) = fs.canonicalize(&path_to_check.path).await.ok()
|
||||
&& let Some(metadata) = fs.metadata(&fs_path_to_check).await.ok().flatten()
|
||||
{
|
||||
path_to_check.path = fs_path_to_check;
|
||||
return Some(OpenTarget::File(path_to_check, metadata));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue