Skip to content

Commit

Permalink
thanks clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Nov 14, 2022
1 parent f030ac2 commit dd94cc5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions gitoxide-core/src/hours/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ pub fn deduplicate_identities(persons: &[WorkByEmail]) -> Vec<WorkByPerson> {
match email_to_index.entry(person_by_email.email) {
Entry::Occupied(email_entry) => {
out[*email_entry.get()].merge(person_by_email);
name_to_index.insert(&person_by_email.name, *email_entry.get());
name_to_index.insert(person_by_email.name, *email_entry.get());
}
Entry::Vacant(email_entry) => match name_to_index.entry(&person_by_email.name) {
Entry::Vacant(email_entry) => match name_to_index.entry(person_by_email.name) {
Entry::Occupied(name_entry) => {
out[*name_entry.get()].merge(person_by_email);
email_entry.insert(*name_entry.get());
Expand Down
11 changes: 5 additions & 6 deletions gitoxide-core/src/hours/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,22 @@ where
let commit_thread = scope.spawn(move || -> anyhow::Result<Vec<_>> {
let mut out = Vec::new();
for (commit_idx, commit_data) in rx {
if let Some(author) = git::objs::CommitRefIter::from_bytes(&commit_data)
if let Ok(author) = git::objs::CommitRefIter::from_bytes(&commit_data)
.author()
.map(|author| mailmap.resolve_cow(author.trim()))
.ok()
{
let mut string_ref = |s: &[u8]| -> &'static BStr {
match string_heap.get(s) {
Some(n) => n.as_bstr(),
None => {
let sv: Vec<u8> = s.to_owned().into();
let sv: Vec<u8> = s.to_owned();
string_heap.insert(Box::leak(sv.into_boxed_slice()));
(*string_heap.get(s).expect("present")).as_ref()
}
}
};
let name = string_ref(author.name.as_ref());
let email = string_ref(&author.email.as_ref());
let email = string_ref(author.email.as_ref());

out.push((
commit_idx,
Expand All @@ -122,7 +121,7 @@ where
}
out.shrink_to_fit();
out.sort_by(|a, b| {
a.1.email.cmp(&b.1.email).then(
a.1.email.cmp(b.1.email).then(
a.1.time
.seconds_since_unix_epoch
.cmp(&b.1.time.seconds_since_unix_epoch)
Expand Down Expand Up @@ -253,7 +252,7 @@ where
.collect::<Vec<_>>();
(Some(tx), stat_workers)
})
.unwrap_or_else(Default::default);
.unwrap_or_default();

let mut commit_idx = 0_u32;
let mut skipped_merge_commits = 0;
Expand Down
8 changes: 4 additions & 4 deletions gitoxide-core/src/hours/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ pub struct WorkByPerson {

impl<'a> WorkByPerson {
pub fn merge(&mut self, other: &'a WorkByEmail) {
if !self.name.contains(&&other.name) {
self.name.push(&other.name);
if !self.name.contains(&other.name) {
self.name.push(other.name);
}
if !self.email.contains(&&other.email) {
self.email.push(&other.email);
if !self.email.contains(&other.email) {
self.email.push(other.email);
}
self.num_commits += other.num_commits;
self.hours += other.hours;
Expand Down
2 changes: 1 addition & 1 deletion gitoxide-core/src/repository/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ pub(crate) mod function {
(
Fix::MappingWithPartialDestinationRemoved { spec: l, .. },
Fix::MappingWithPartialDestinationRemoved { spec: r, .. },
) => l.cmp(&r),
) => l.cmp(r),
});
let mut prev_spec = None;
for fix in &map.fixes {
Expand Down
4 changes: 2 additions & 2 deletions gitoxide-core/src/repository/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ mod refs_impl {
(
Fix::MappingWithPartialDestinationRemoved { spec: l, .. },
Fix::MappingWithPartialDestinationRemoved { spec: r, .. },
) => l.cmp(&r),
) => l.cmp(r),
});
let mut prev_spec = None;
for fix in &map.fixes {
Expand Down Expand Up @@ -308,7 +308,7 @@ pub(crate) fn by_name_or_url<'repo>(
if name.contains('/') || name.contains('.') {
repo.remote_at(git_repository::url::parse(name.into())?)?
} else {
repo.find_remote(&name)?
repo.find_remote(name)?
}
}
None => repo
Expand Down

0 comments on commit dd94cc5

Please sign in to comment.