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:
parent
df9c2aefb1
commit
05fc0c432c
239 changed files with 854 additions and 1015 deletions
|
@ -88,11 +88,10 @@ impl CommitView {
|
|||
let ix = pane.items().position(|item| {
|
||||
let commit_view = item.downcast::<CommitView>();
|
||||
commit_view
|
||||
.map_or(false, |view| view.read(cx).commit.sha == commit.sha)
|
||||
.is_some_and(|view| view.read(cx).commit.sha == commit.sha)
|
||||
});
|
||||
if let Some(ix) = ix {
|
||||
pane.activate_item(ix, true, true, window, cx);
|
||||
return;
|
||||
} else {
|
||||
pane.add_item(Box::new(commit_view), true, true, None, window, cx);
|
||||
}
|
||||
|
|
|
@ -775,7 +775,7 @@ impl GitPanel {
|
|||
|
||||
if window
|
||||
.focused(cx)
|
||||
.map_or(false, |focused| self.focus_handle == focused)
|
||||
.is_some_and(|focused| self.focus_handle == focused)
|
||||
{
|
||||
dispatch_context.add("menu");
|
||||
dispatch_context.add("ChangesList");
|
||||
|
@ -894,9 +894,7 @@ impl GitPanel {
|
|||
let have_entries = self
|
||||
.active_repository
|
||||
.as_ref()
|
||||
.map_or(false, |active_repository| {
|
||||
active_repository.read(cx).status_summary().count > 0
|
||||
});
|
||||
.is_some_and(|active_repository| active_repository.read(cx).status_summary().count > 0);
|
||||
if have_entries && self.selected_entry.is_none() {
|
||||
self.selected_entry = Some(1);
|
||||
self.scroll_to_selected_entry(cx);
|
||||
|
@ -1207,9 +1205,7 @@ impl GitPanel {
|
|||
})
|
||||
.ok();
|
||||
}
|
||||
_ => {
|
||||
return;
|
||||
}
|
||||
_ => {}
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
|
@ -1640,13 +1636,12 @@ impl GitPanel {
|
|||
fn has_commit_message(&self, cx: &mut Context<Self>) -> bool {
|
||||
let text = self.commit_editor.read(cx).text(cx);
|
||||
if !text.trim().is_empty() {
|
||||
return true;
|
||||
true
|
||||
} else if text.is_empty() {
|
||||
return self
|
||||
.suggest_commit_message(cx)
|
||||
.is_some_and(|text| !text.trim().is_empty());
|
||||
self.suggest_commit_message(cx)
|
||||
.is_some_and(|text| !text.trim().is_empty())
|
||||
} else {
|
||||
return false;
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2938,8 +2933,7 @@ impl GitPanel {
|
|||
.matches(git::repository::REMOTE_CANCELLED_BY_USER)
|
||||
.next()
|
||||
.is_some()
|
||||
{
|
||||
return; // Hide the cancelled by user message
|
||||
{ // Hide the cancelled by user message
|
||||
} else {
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
let workspace_weak = cx.weak_entity();
|
||||
|
@ -3272,12 +3266,10 @@ impl GitPanel {
|
|||
} else {
|
||||
"Amend Tracked"
|
||||
}
|
||||
} else if self.has_staged_changes() {
|
||||
"Commit"
|
||||
} else {
|
||||
if self.has_staged_changes() {
|
||||
"Commit"
|
||||
} else {
|
||||
"Commit Tracked"
|
||||
}
|
||||
"Commit Tracked"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4498,7 +4490,7 @@ impl Render for GitPanel {
|
|||
|
||||
let has_write_access = self.has_write_access(cx);
|
||||
|
||||
let has_co_authors = room.map_or(false, |room| {
|
||||
let has_co_authors = room.is_some_and(|room| {
|
||||
self.load_local_committer(cx);
|
||||
let room = room.read(cx);
|
||||
room.remote_participants()
|
||||
|
@ -4814,12 +4806,10 @@ impl RenderOnce for PanelRepoFooter {
|
|||
|
||||
// ideally, show the whole branch and repo names but
|
||||
// when we can't, use a budget to allocate space between the two
|
||||
let (repo_display_len, branch_display_len) = if branch_actual_len + repo_actual_len
|
||||
<= LABEL_CHARACTER_BUDGET
|
||||
{
|
||||
(repo_actual_len, branch_actual_len)
|
||||
} else {
|
||||
if branch_actual_len <= MAX_BRANCH_LEN {
|
||||
let (repo_display_len, branch_display_len) =
|
||||
if branch_actual_len + repo_actual_len <= LABEL_CHARACTER_BUDGET {
|
||||
(repo_actual_len, branch_actual_len)
|
||||
} else if branch_actual_len <= MAX_BRANCH_LEN {
|
||||
let repo_space = (LABEL_CHARACTER_BUDGET - branch_actual_len).min(MAX_REPO_LEN);
|
||||
(repo_space, branch_actual_len)
|
||||
} else if repo_actual_len <= MAX_REPO_LEN {
|
||||
|
@ -4827,8 +4817,7 @@ impl RenderOnce for PanelRepoFooter {
|
|||
(repo_actual_len, branch_space)
|
||||
} else {
|
||||
(MAX_REPO_LEN, MAX_BRANCH_LEN)
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
let truncated_repo_name = if repo_actual_len <= repo_display_len {
|
||||
active_repo_name.to_string()
|
||||
|
|
|
@ -329,14 +329,14 @@ impl ProjectDiff {
|
|||
})
|
||||
.ok();
|
||||
|
||||
return ButtonStates {
|
||||
ButtonStates {
|
||||
stage: has_unstaged_hunks,
|
||||
unstage: has_staged_hunks,
|
||||
prev_next,
|
||||
selection,
|
||||
stage_all,
|
||||
unstage_all,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_editor_event(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue