Zero warnings on Windows and Linux, clippy included (W-02, L-02)
rustc and clippy are clean for the whole workspace, every target, on both. clippy --fix moved test modules last and took the shorter forms; long types got named aliases; ElyTree's form takes its title and button words as one pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c96d39a342
commit
9c9f9ab8f9
26 files changed
+73
-60
No files matched your search
@@ -251,8 +251,7 @@ impl Tree {
|
||||
let (title, go) = (label("tree.branch.title"), label("tree.branch.create"));
|
||||
Some(self.form(
|
||||
"tree-new-branch",
|
||||
title,
|
||||
go,
|
||||
(title, go),
|
||||
rows,
|
||||
Some(toggle.into_any_element()),
|
||||
dismiss,
|
||||
@@ -271,7 +270,7 @@ impl Tree {
|
||||
div().w_full().child(Input::new(message)),
|
||||
);
|
||||
let (title, go) = (label("tree.tag.title"), label("tree.tag.create"));
|
||||
Some(self.form("tree-new-tag", title, go, rows, None, dismiss, cx))
|
||||
Some(self.form("tree-new-tag", (title, go), rows, None, dismiss, cx))
|
||||
}
|
||||
Ask::Rename { old, name, .. } => {
|
||||
let label = |key: &str| text(cx, key, &[]);
|
||||
@@ -283,7 +282,7 @@ impl Tree {
|
||||
text(cx, "tree.rename.title", &[("name", old)]),
|
||||
label("tree.rename.go"),
|
||||
);
|
||||
Some(self.form("tree-rename", title, go, rows, None, dismiss, cx))
|
||||
Some(self.form("tree-rename", (title, go), rows, None, dismiss, cx))
|
||||
}
|
||||
Ask::Stash { .. }
|
||||
| Ask::Remote { .. }
|
||||
@@ -347,8 +346,7 @@ impl Tree {
|
||||
pub(crate) fn form(
|
||||
&self,
|
||||
id: &'static str,
|
||||
title: gpui::SharedString,
|
||||
go: gpui::SharedString,
|
||||
(title, go): (gpui::SharedString, gpui::SharedString),
|
||||
rows: DescriptionList,
|
||||
extra: Option<AnyElement>,
|
||||
dismiss: impl Fn(&mut Window, &mut App) + 'static,
|
||||
|
||||
@@ -56,7 +56,7 @@ impl Tree {
|
||||
},
|
||||
);
|
||||
let (title, go) = (label("tree.stash.title"), label("tree.stash.go"));
|
||||
self.form("tree-stash", title, go, rows, Some(extra), dismiss, cx)
|
||||
self.form("tree-stash", (title, go), rows, Some(extra), dismiss, cx)
|
||||
}
|
||||
Ask::Remote { old, name, url, .. } => {
|
||||
let rows = DescriptionList::new()
|
||||
@@ -73,7 +73,7 @@ impl Tree {
|
||||
None => label("tree.remote.add"),
|
||||
};
|
||||
let go = label("tree.remote.save");
|
||||
self.form("tree-remote", title, go, rows, None, dismiss, cx)
|
||||
self.form("tree-remote", (title, go), rows, None, dismiss, cx)
|
||||
}
|
||||
Ask::Worktree {
|
||||
path, branch, new, ..
|
||||
@@ -90,7 +90,7 @@ impl Tree {
|
||||
let shown = path.display().to_string();
|
||||
let title = text(cx, "tree.worktree.title", &[("path", &shown)]);
|
||||
let go = label("tree.worktree.go");
|
||||
self.form("tree-worktree", title, go, rows, Some(extra), dismiss, cx)
|
||||
self.form("tree-worktree", (title, go), rows, Some(extra), dismiss, cx)
|
||||
}
|
||||
Ask::Force { repo, plan } => {
|
||||
let lost = match plan.lost.len() {
|
||||
|
||||
@@ -150,11 +150,10 @@ impl Tree {
|
||||
(self.amend, self.draft) = (false, None);
|
||||
self.fill("", "", cx);
|
||||
}
|
||||
} else if let Some(opened) = self.opened_mut(id) {
|
||||
if commit::message(&opened.held.subject, &opened.held.body) == message {
|
||||
} else if let Some(opened) = self.opened_mut(id)
|
||||
&& commit::message(&opened.held.subject, &opened.held.body) == message {
|
||||
opened.held = Held::default();
|
||||
}
|
||||
}
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ impl Tree {
|
||||
pub fn search(&mut self, cx: &mut Context<Self>) {
|
||||
let Some(id) = self.active else { return };
|
||||
let text = self.search.read(cx).text().trim().to_string();
|
||||
let query = (!text.is_empty()).then(|| Query {
|
||||
let query = (!text.is_empty()).then_some(Query {
|
||||
find: self.find,
|
||||
text,
|
||||
});
|
||||
|
||||
@@ -195,10 +195,8 @@ impl Tree {
|
||||
/// Pick, revert, or branch or tag at this commit.
|
||||
fn commit_actions(&self, detail: &Detail, cx: &mut Context<Self>) -> AnyElement {
|
||||
let (id, parents) = (detail.id.clone(), detail.parents.len());
|
||||
let acts: [(
|
||||
&str,
|
||||
Box<dyn Fn(&mut Tree, &mut gpui::Window, &mut Context<Tree>)>,
|
||||
); 4] = [
|
||||
type Act = Box<dyn Fn(&mut Tree, &mut gpui::Window, &mut Context<Tree>)>;
|
||||
let acts: [(&str, Act); 4] = [
|
||||
("tree.commit.pick_it", {
|
||||
let id = id.clone();
|
||||
Box::new(move |tree, _, cx| tree.cherry_pick(&id, parents, cx))
|
||||
|
||||
@@ -13,6 +13,9 @@ use crate::{
|
||||
tree::Tree,
|
||||
};
|
||||
|
||||
/// A commit and its added and removed line counts.
|
||||
type Row = (Commit, Option<(usize, usize)>);
|
||||
|
||||
pub enum Look {
|
||||
FileLog {
|
||||
repo: u64,
|
||||
@@ -20,7 +23,7 @@ pub enum Look {
|
||||
serial: u64,
|
||||
path: String,
|
||||
touches: Option<Result<Vec<Touch>, String>>,
|
||||
rows: Rc<Vec<(Commit, Option<(usize, usize)>)>>,
|
||||
rows: Rc<Vec<Row>>,
|
||||
picked: Option<usize>,
|
||||
view: Option<Result<View, String>>,
|
||||
},
|
||||
|
||||
@@ -18,7 +18,7 @@ pub fn records(bytes: &[u8], n: usize) -> io::Result<Vec<Vec<&str>>> {
|
||||
if fields.last() == Some(&"") {
|
||||
fields.pop();
|
||||
}
|
||||
if fields.len() % n != 0 {
|
||||
if !fields.len().is_multiple_of(n) {
|
||||
return Err(bad(text));
|
||||
}
|
||||
Ok(fields.chunks(n).map(<[&str]>::to_vec).collect())
|
||||
|
||||
@@ -53,7 +53,9 @@ pub(crate) fn committed(dir: &Path) -> PathBuf {
|
||||
root
|
||||
}
|
||||
|
||||
fn paths(files: &[Changed]) -> Vec<(&str, GitStatus, Option<(usize, usize)>)> {
|
||||
type Listed<'a> = (&'a str, GitStatus, Option<(usize, usize)>);
|
||||
|
||||
fn paths(files: &[Changed]) -> Vec<Listed<'_>> {
|
||||
files
|
||||
.iter()
|
||||
.map(|file| (file.path.as_ref(), file.status, file.lines))
|
||||
|
||||
Reference in new issue
Block a user