Skip to content

Commit 5f40f62

Browse files
committed
cleanup: remove redundant + use<'_> after migrating to 2024 edition
AliasFunctionOverloads::arities() doesn't need to capture &self, but it's not important to describe the lifetime precisely here.
1 parent 0034daa commit 5f40f62

File tree

17 files changed

+65
-84
lines changed

17 files changed

+65
-84
lines changed

cli/src/complete.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,10 +1116,10 @@ impl JjBuilder {
11161116
/// multiple times, the parsing will pick any of the available ones, while the
11171117
/// actual execution of the command would fail.
11181118
mod parse {
1119-
pub(super) fn parse_flag<'a, I: Iterator<Item = String>>(
1120-
candidates: &'a [&str],
1121-
mut args: I,
1122-
) -> impl Iterator<Item = String> + use<'a, I> {
1119+
pub(super) fn parse_flag(
1120+
candidates: &[&str],
1121+
mut args: impl Iterator<Item = String>,
1122+
) -> impl Iterator<Item = String> {
11231123
std::iter::from_fn(move || {
11241124
for arg in args.by_ref() {
11251125
// -r REV syntax

cli/src/ui.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ fn duplicate_child_stdin(stdin: &ChildStdin) -> io::Result<std::os::windows::io:
762762
stdin.as_handle().try_clone_to_owned()
763763
}
764764

765-
fn format_error_with_sources(err: &dyn error::Error) -> impl fmt::Display + use<'_> {
765+
fn format_error_with_sources(err: &dyn error::Error) -> impl fmt::Display {
766766
iter::successors(Some(err), |&err| err.source()).format(": ")
767767
}
768768

lib/src/commit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl Commit {
100100
&self.data.parents
101101
}
102102

103-
pub fn parents(&self) -> impl Iterator<Item = BackendResult<Self>> + use<'_> {
103+
pub fn parents(&self) -> impl Iterator<Item = BackendResult<Self>> {
104104
self.data.parents.iter().map(|id| self.store.get_commit(id))
105105
}
106106

lib/src/conflicts.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -687,10 +687,10 @@ pub struct MaterializedTreeDiffEntry {
687687
pub values: BackendResult<(MaterializedTreeValue, MaterializedTreeValue)>,
688688
}
689689

690-
pub fn materialized_diff_stream<'a>(
691-
store: &'a Store,
692-
tree_diff: BoxStream<'a, CopiesTreeDiffEntry>,
693-
) -> impl Stream<Item = MaterializedTreeDiffEntry> + use<'a> {
690+
pub fn materialized_diff_stream(
691+
store: &Store,
692+
tree_diff: BoxStream<'_, CopiesTreeDiffEntry>,
693+
) -> impl Stream<Item = MaterializedTreeDiffEntry> {
694694
tree_diff
695695
.map(async |CopiesTreeDiffEntry { path, values }| match values {
696696
Err(err) => MaterializedTreeDiffEntry {

lib/src/default_index/composite.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ impl CompositeCommitIndex {
367367
self.heads_pos(result)
368368
}
369369

370-
pub(super) fn all_heads(&self) -> impl Iterator<Item = CommitId> + use<'_> {
370+
pub(super) fn all_heads(&self) -> impl Iterator<Item = CommitId> {
371371
self.all_heads_pos()
372372
.map(move |pos| self.entry_by_pos(pos).commit_id())
373373
}

lib/src/default_index/readonly.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ impl ReadonlyCommitIndexSegment {
457457
fn overflow_changes_from(
458458
&self,
459459
overflow_pos: u32,
460-
) -> impl Iterator<Item = LocalCommitPosition> + use<'_> {
460+
) -> impl Iterator<Item = LocalCommitPosition> {
461461
let table = &self.data[self.change_overflow_base..];
462462
let offset = (overflow_pos as usize) * 4;
463463
let (chunks, _remainder) = table[offset..].as_chunks();

lib/src/default_index/revset_engine.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ impl<I: AsCompositeIndex + Clone> RevsetImpl<I> {
121121

122122
fn positions(
123123
&self,
124-
) -> impl Iterator<Item = Result<GlobalCommitPosition, RevsetEvaluationError>> + use<'_, I>
125-
{
124+
) -> impl Iterator<Item = Result<GlobalCommitPosition, RevsetEvaluationError>> {
126125
self.inner.positions().attach(self.index.as_composite())
127126
}
128127

@@ -1420,10 +1419,7 @@ fn diff_match_lines(
14201419
}
14211420
}
14221421

1423-
fn match_lines<'a, 'b>(
1424-
text: &'a [u8],
1425-
pattern: &'b StringPattern,
1426-
) -> impl Iterator<Item = &'a [u8]> + use<'a, 'b> {
1422+
fn match_lines<'a>(text: &'a [u8], pattern: &StringPattern) -> impl Iterator<Item = &'a [u8]> {
14271423
// The pattern is matched line by line so that it can be anchored to line
14281424
// start/end. For example, exact:"" will match blank lines.
14291425
text.split_inclusive(|b| *b == b'\n').filter(|line| {

lib/src/diff.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ pub fn find_nonword_ranges(text: &[u8]) -> Vec<Range<usize>> {
7676
.collect()
7777
}
7878

79-
fn bytes_ignore_all_whitespace(text: &[u8]) -> impl Iterator<Item = u8> + use<'_> {
79+
fn bytes_ignore_all_whitespace(text: &[u8]) -> impl Iterator<Item = u8> {
8080
text.iter().copied().filter(|b| !b.is_ascii_whitespace())
8181
}
8282

83-
fn bytes_ignore_whitespace_amount(text: &[u8]) -> impl Iterator<Item = u8> + use<'_> {
83+
fn bytes_ignore_whitespace_amount(text: &[u8]) -> impl Iterator<Item = u8> {
8484
let mut prev_was_space = false;
8585
text.iter().filter_map(move |&b| {
8686
let was_space = prev_was_space;
@@ -295,8 +295,7 @@ impl<'input> LocalDiffSource<'input, '_> {
295295

296296
fn hashed_words(
297297
&self,
298-
) -> impl DoubleEndedIterator<Item = HashedWord<'input>> + ExactSizeIterator + use<'_, 'input>
299-
{
298+
) -> impl DoubleEndedIterator<Item = HashedWord<'input>> + ExactSizeIterator {
300299
iter::zip(self.ranges, self.hashes).map(|(range, &hash)| {
301300
let text = &self.text[range.clone()];
302301
HashedWord { hash, text }
@@ -780,22 +779,19 @@ impl<'input> ContentDiff<'input> {
780779
}
781780

782781
/// Returns contents at the unchanged `range`.
783-
fn hunk_at<'a, 'b>(
784-
&'a self,
785-
range: &'b UnchangedRange,
786-
) -> impl Iterator<Item = &'input BStr> + use<'a, 'b, 'input> {
782+
fn hunk_at(&self, range: &UnchangedRange) -> impl Iterator<Item = &'input BStr> {
787783
itertools::chain(
788784
iter::once(&self.base_input[range.base.clone()]),
789785
iter::zip(&self.other_inputs, &range.others).map(|(input, r)| &input[r.clone()]),
790786
)
791787
}
792788

793789
/// Returns contents between the `previous` ends and the `current` starts.
794-
fn hunk_between<'a, 'b>(
795-
&'a self,
796-
previous: &'b UnchangedRange,
797-
current: &'b UnchangedRange,
798-
) -> impl Iterator<Item = &'input BStr> + use<'a, 'b, 'input> {
790+
fn hunk_between(
791+
&self,
792+
previous: &UnchangedRange,
793+
current: &UnchangedRange,
794+
) -> impl Iterator<Item = &'input BStr> {
799795
itertools::chain(
800796
iter::once(&self.base_input[previous.base.end..current.base.start]),
801797
itertools::izip!(&self.other_inputs, &previous.others, &current.others)

lib/src/dsl_util.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,7 @@ struct AliasFunctionOverloads<'a, V> {
604604
}
605605

606606
impl<'a, V> AliasFunctionOverloads<'a, V> {
607-
// TODO: Perhaps, V doesn't have to be captured, but "currently, all type
608-
// parameters are required to be mentioned in the precise captures list" as
609-
// of rustc 1.85.0.
610-
fn arities(&self) -> impl DoubleEndedIterator<Item = usize> + ExactSizeIterator + use<'a, V> {
607+
fn arities(&self) -> impl DoubleEndedIterator<Item = usize> + ExactSizeIterator {
611608
self.overloads.iter().map(|(params, _)| params.len())
612609
}
613610

lib/src/evolution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl CommitEvolutionEntry {
5858
}
5959

6060
/// Predecessor commit objects of this commit.
61-
pub fn predecessors(&self) -> impl ExactSizeIterator<Item = BackendResult<Commit>> + use<'_> {
61+
pub fn predecessors(&self) -> impl ExactSizeIterator<Item = BackendResult<Commit>> {
6262
let store = self.commit.store();
6363
self.predecessor_ids().iter().map(|id| store.get_commit(id))
6464
}

0 commit comments

Comments
 (0)