Skip to content

Commit

Permalink
style: remove unneeded lifetimes from trait implementations
Browse files Browse the repository at this point in the history
Clippy 1.83 (currently in beta) detects more cases of unneeded lifetimes,
namely in trait implementation declarations. Since this lint is warn by
default, we need to fix those instances to get a clean CI.
  • Loading branch information
samueltardieu committed Oct 17, 2024
1 parent 33f9b89 commit 2112584
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cli/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ impl Write for FormatRecorder {

struct RawEscapeSequenceRecorder<'a>(&'a mut FormatRecorder);

impl<'a> Write for RawEscapeSequenceRecorder<'a> {
impl Write for RawEscapeSequenceRecorder<'_> {
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
self.0.push_op(FormatOp::RawEscapeSequence(data.to_vec()));
Ok(data.len())
Expand Down
2 changes: 1 addition & 1 deletion cli/src/graphlog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<K: Clone> From<&Edge<K>> for Ancestor<K> {
}
}

impl<'writer, K, R> GraphLog<K> for SaplingGraphLog<'writer, R>
impl<K, R> GraphLog<K> for SaplingGraphLog<'_, R>
where
K: Clone + Eq + Hash,
R: Renderer<K, Output = String>,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/default_index/revset_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ fn to_u32_generation_range(range: &Range<u64>) -> Result<Range<u32>, RevsetEvalu
Ok(start..end)
}

impl<'index> EvaluationContext<'index> {
impl EvaluationContext<'_> {
fn evaluate(
&self,
expression: &ResolvedExpression,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ impl<'diff, 'input> DiffHunkIterator<'diff, 'input> {
}
}

impl<'diff, 'input> Iterator for DiffHunkIterator<'diff, 'input> {
impl<'input> Iterator for DiffHunkIterator<'_, 'input> {
type Item = DiffHunk<'input>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ where
}
}

impl<'a, I> DiffLineIterator<'a, I> {
impl<I> DiffLineIterator<'_, I> {
/// Returns line number of the next hunk. After all hunks are consumed, this
/// returns the next line number if the last hunk ends with newline.
pub fn next_line_number(&self) -> DiffLineNumber {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/id_prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ pub struct IdIndexLookup<'i, 'q, K, P, S, const N: usize> {
pos: usize, // may be index.len()
}

impl<'i, 'q, K, P, S, const N: usize> IdIndexLookup<'i, 'q, K, P, S, N>
impl<K, P, S, const N: usize> IdIndexLookup<'_, '_, K, P, S, N>
where
K: ObjectId + Eq,
S: IdIndexSource<P>,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/revset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2225,7 +2225,7 @@ pub trait RevsetIteratorExt<'index, I> {
fn reversed(self) -> ReverseRevsetIterator;
}

impl<'index, I: Iterator<Item = CommitId>> RevsetIteratorExt<'index, I> for I {
impl<I: Iterator<Item = CommitId>> RevsetIteratorExt<'_, I> for I {
fn commits(self, store: &Arc<Store>) -> RevsetCommitIterator<I> {
RevsetCommitIterator {
iter: self,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ pub struct LockedWorkspace<'a> {
locked_wc: Box<dyn LockedWorkingCopy>,
}

impl<'a> LockedWorkspace<'a> {
impl LockedWorkspace<'_> {
pub fn locked_wc(&mut self) -> &mut dyn LockedWorkingCopy {
self.locked_wc.as_mut()
}
Expand Down

0 comments on commit 2112584

Please sign in to comment.