Skip to content

Commit

Permalink
Rollup merge of rust-lang#130522 - GnomedDev:clippy-manual-retain-pat…
Browse files Browse the repository at this point in the history
…hs, r=compiler-errors

[Clippy] Swap `manual_retain` to use diagnostic items instead of paths

Part of rust-lang/rust-clippy#5393, just a chore.
  • Loading branch information
workingjubilee authored Sep 18, 2024
2 parents 8a9576c + ff51d9f commit 1509944
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions alloc/src/collections/binary_heap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@ impl<T, A: Allocator> BinaryHeap<T, A> {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "binaryheap_iter")]
pub fn iter(&self) -> Iter<'_, T> {
Iter { iter: self.data.iter() }
}
Expand Down
1 change: 1 addition & 0 deletions alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,7 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
/// assert_eq!(set_iter.next(), None);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "btreeset_iter")]
pub fn iter(&self) -> Iter<'_, T> {
Iter { iter: self.map.keys() }
}
Expand Down
1 change: 1 addition & 0 deletions alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// assert_eq!(&c[..], b);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "vecdeque_iter")]
pub fn iter(&self) -> Iter<'_, T> {
let (a, b) = self.as_slices();
Iter::new(a.iter(), b.iter())
Expand Down
3 changes: 3 additions & 0 deletions core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,7 @@ pub trait Iterator {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
#[cfg_attr(not(test), rustc_diagnostic_item = "iter_filter")]
fn filter<P>(self, predicate: P) -> Filter<Self, P>
where
Self: Sized,
Expand Down Expand Up @@ -3412,6 +3413,7 @@ pub trait Iterator {
/// ```
#[stable(feature = "iter_copied", since = "1.36.0")]
#[rustc_do_not_const_check]
#[cfg_attr(not(test), rustc_diagnostic_item = "iter_copied")]
fn copied<'a, T: 'a>(self) -> Copied<Self>
where
Self: Sized + Iterator<Item = &'a T>,
Expand Down Expand Up @@ -3460,6 +3462,7 @@ pub trait Iterator {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
#[cfg_attr(not(test), rustc_diagnostic_item = "iter_cloned")]
fn cloned<'a, T: 'a>(self) -> Cloned<Self>
where
Self: Sized + Iterator<Item = &'a T>,
Expand Down
1 change: 1 addition & 0 deletions core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,7 @@ impl<T> [T] {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
#[cfg_attr(not(test), rustc_diagnostic_item = "slice_iter")]
pub fn iter(&self) -> Iter<'_, T> {
Iter::new(self)
}
Expand Down
1 change: 1 addition & 0 deletions core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@ impl str {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
#[cfg_attr(not(test), rustc_diagnostic_item = "str_chars")]
pub fn chars(&self) -> Chars<'_> {
Chars { iter: self.as_bytes().iter() }
}
Expand Down
1 change: 1 addition & 0 deletions std/src/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ impl<T, S> HashSet<T, S> {
#[inline]
#[rustc_lint_query_instability]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "hashset_iter")]
pub fn iter(&self) -> Iter<'_, T> {
Iter { base: self.base.iter() }
}
Expand Down

0 comments on commit 1509944

Please sign in to comment.