Enable clippy::needless_lifetimes (#8777)

This PR enables the
[`clippy::needless_lifetimes`](https://rust-lang.github.io/rust-clippy/master/index.html#/needless_lifetimes)
rule and fixes the outstanding violations.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-03-03 11:52:58 -05:00 committed by GitHub
parent 1fa9496334
commit 53630dc74c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 67 additions and 78 deletions

View file

@ -2839,10 +2839,10 @@ impl BufferSnapshot {
}
/// Returns bracket range pairs overlapping or adjacent to `range`
pub fn bracket_ranges<'a, T: ToOffset>(
&'a self,
pub fn bracket_ranges<T: ToOffset>(
&self,
range: Range<T>,
) -> impl Iterator<Item = (Range<usize>, Range<usize>)> + 'a {
) -> impl Iterator<Item = (Range<usize>, Range<usize>)> + '_ {
// Find bracket pairs that *inclusively* contain the given range.
let range = range.start.to_offset(self).saturating_sub(1)
..self.len().min(range.end.to_offset(self) + 1);
@ -2935,10 +2935,10 @@ impl BufferSnapshot {
/// Returns anchor ranges for any matches of the redaction query.
/// The buffer can be associated with multiple languages, and the redaction query associated with each
/// will be run on the relevant section of the buffer.
pub fn redacted_ranges<'a, T: ToOffset>(
&'a self,
pub fn redacted_ranges<T: ToOffset>(
&self,
range: Range<T>,
) -> impl Iterator<Item = Range<usize>> + 'a {
) -> impl Iterator<Item = Range<usize>> + '_ {
let offset_range = range.start.to_offset(self)..range.end.to_offset(self);
let mut syntax_matches = self.syntax.matches(offset_range, self, |grammar| {
grammar
@ -3015,28 +3015,28 @@ impl BufferSnapshot {
/// Returns all the Git diff hunks intersecting the given
/// row range.
pub fn git_diff_hunks_in_row_range<'a>(
&'a self,
pub fn git_diff_hunks_in_row_range(
&self,
range: Range<u32>,
) -> impl 'a + Iterator<Item = git::diff::DiffHunk<u32>> {
) -> impl '_ + Iterator<Item = git::diff::DiffHunk<u32>> {
self.git_diff.hunks_in_row_range(range, self)
}
/// Returns all the Git diff hunks intersecting the given
/// range.
pub fn git_diff_hunks_intersecting_range<'a>(
&'a self,
pub fn git_diff_hunks_intersecting_range(
&self,
range: Range<Anchor>,
) -> impl 'a + Iterator<Item = git::diff::DiffHunk<u32>> {
) -> impl '_ + Iterator<Item = git::diff::DiffHunk<u32>> {
self.git_diff.hunks_intersecting_range(range, self)
}
/// Returns all the Git diff hunks intersecting the given
/// range, in reverse order.
pub fn git_diff_hunks_intersecting_range_rev<'a>(
&'a self,
pub fn git_diff_hunks_intersecting_range_rev(
&self,
range: Range<Anchor>,
) -> impl 'a + Iterator<Item = git::diff::DiffHunk<u32>> {
) -> impl '_ + Iterator<Item = git::diff::DiffHunk<u32>> {
self.git_diff.hunks_intersecting_range_rev(range, self)
}