Skip to content

Commit

Permalink
thanks clippy
Browse files Browse the repository at this point in the history
compatibility with Rust 1.71
  • Loading branch information
Byron committed Jul 14, 2023
1 parent cbb0db8 commit 3ef32af
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 18 deletions.
4 changes: 2 additions & 2 deletions gitoxide-core/src/hours/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl LineStats {
/// An index able to address any commit
pub type CommitIdx = u32;

pub fn add_lines(line_stats: bool, lines_counter: Option<&AtomicUsize>, mut lines: &mut LineStats, id: gix::Id<'_>) {
pub fn add_lines(line_stats: bool, lines_counter: Option<&AtomicUsize>, lines: &mut LineStats, id: gix::Id<'_>) {
if let Some(Ok(blob)) = line_stats.then(|| id.object()) {
let nl = blob.data.lines_with_terminator().count();
lines.added += nl;
Expand All @@ -168,7 +168,7 @@ pub fn add_lines(line_stats: bool, lines_counter: Option<&AtomicUsize>, mut line
}
}

pub fn remove_lines(line_stats: bool, lines_counter: Option<&AtomicUsize>, mut lines: &mut LineStats, id: gix::Id<'_>) {
pub fn remove_lines(line_stats: bool, lines_counter: Option<&AtomicUsize>, lines: &mut LineStats, id: gix::Id<'_>) {
if let Some(Ok(blob)) = line_stats.then(|| id.object()) {
let nl = blob.data.lines_with_terminator().count();
lines.removed += nl;
Expand Down
9 changes: 3 additions & 6 deletions gix-config/src/file/access/mutate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ impl<'event> File<'event> {
) -> Result<SectionMut<'a, 'event>, lookup::existing::Error> {
let id = self
.section_ids_by_name_and_subname(name.as_ref(), subsection_name)?
.rev()
.next()
.next_back()
.expect("BUG: Section lookup vec was empty");
let nl = self.detect_newline_style_smallvec();
Ok(self
Expand Down Expand Up @@ -212,8 +211,7 @@ impl<'event> File<'event> {
let id = self
.section_ids_by_name_and_subname(name, subsection_name.into())
.ok()?
.rev()
.next()?;
.next_back()?;
self.remove_section_by_id(id)
}

Expand Down Expand Up @@ -298,8 +296,7 @@ impl<'event> File<'event> {
) -> Result<(), rename_section::Error> {
let id = self
.section_ids_by_name_and_subname(name.as_ref(), subsection_name.into())?
.rev()
.next()
.next_back()
.expect("list of sections were empty, which violates invariant");
let section = self.sections.get_mut(&id).expect("known section-id");
section.header = section::Header::new(new_name, new_subsection_name)?;
Expand Down
2 changes: 1 addition & 1 deletion gix-config/src/file/mutable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<'a> Whitespace<'a> {
.find_map(|(idx, e)| matches!(e, Event::SectionKey(_)).then(|| idx));
key_pos
.map(|key_pos| {
let pre_key = s.0[..key_pos].iter().rev().next().and_then(|e| match e {
let pre_key = s.0[..key_pos].iter().next_back().and_then(|e| match e {
Event::Whitespace(s) => Some(s.clone()),
_ => None,
});
Expand Down
2 changes: 1 addition & 1 deletion gix-discover/src/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ mod path {
) -> Option<Self> {
let cwd = current_dir.as_ref();
let normalize_on_trailing_dot_dot = |dir: PathBuf| -> Option<PathBuf> {
if !matches!(dir.components().rev().next(), Some(std::path::Component::ParentDir)) {
if !matches!(dir.components().next_back(), Some(std::path::Component::ParentDir)) {
dir
} else {
gix_path::normalize(&dir, cwd)?.into_owned()
Expand Down
2 changes: 1 addition & 1 deletion gix-pack/src/cache/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ mod memory {
MemoryCappedHashmap {
inner: clru::CLruCache::with_config(
clru::CLruCacheConfig::new(NonZeroUsize::new(memory_cap_in_bytes).expect("non zero"))
.with_hasher(gix_hashtable::hash::Builder::default())
.with_hasher(gix_hashtable::hash::Builder)
.with_scale(CustomScale),
),
free_list: Vec::new(),
Expand Down
2 changes: 1 addition & 1 deletion gix-pack/src/data/output/count/objects/reduce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ where
total: Default::default(),
counts: Default::default(),
progress,
_err: PhantomData::default(),
_err: PhantomData,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gix-pack/src/data/output/entry/iter_from_counts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ mod reduce {
fn default() -> Self {
Statistics {
total: Default::default(),
_err: PhantomData::default(),
_err: PhantomData,
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions gix-transport/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ pub use traits::IsSpuriousError;
pub mod client;

#[doc(inline)]
#[cfg(any(
feature = "blocking-client",
all(feature = "async-client", any(feature = "async-std"))
))]
#[cfg(any(feature = "blocking-client", all(feature = "async-client", feature = "async-std")))]
pub use client::connect;

#[cfg(all(feature = "async-client", feature = "blocking-client"))]
Expand Down
2 changes: 1 addition & 1 deletion gix/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub use gix_object as objs;
pub use gix_object::bstr;
pub use gix_odb as odb;
pub use gix_prompt as prompt;
#[cfg(all(feature = "gix-protocol"))]
#[cfg(feature = "gix-protocol")]
pub use gix_protocol as protocol;
pub use gix_ref as refs;
pub use gix_refspec as refspec;
Expand Down

0 comments on commit 3ef32af

Please sign in to comment.