From ff51d9fe674e5d4ee0c709298e139c8ea2099792 Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Wed, 18 Sep 2024 16:59:57 +0100 Subject: [PATCH] [Clippy] Swap `manual_retain` to use diagnostic items instead of paths --- alloc/src/collections/binary_heap/mod.rs | 1 + alloc/src/collections/btree/set.rs | 1 + alloc/src/collections/vec_deque/mod.rs | 1 + core/src/iter/traits/iterator.rs | 3 +++ core/src/slice/mod.rs | 1 + core/src/str/mod.rs | 1 + std/src/collections/hash/set.rs | 1 + 7 files changed, 9 insertions(+) diff --git a/alloc/src/collections/binary_heap/mod.rs b/alloc/src/collections/binary_heap/mod.rs index fe9f1010d327c..a19a044fc7e2f 100644 --- a/alloc/src/collections/binary_heap/mod.rs +++ b/alloc/src/collections/binary_heap/mod.rs @@ -959,6 +959,7 @@ impl BinaryHeap { /// } /// ``` #[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() } } diff --git a/alloc/src/collections/btree/set.rs b/alloc/src/collections/btree/set.rs index 2b5bebcd8cd08..770cd80ea9c2e 100644 --- a/alloc/src/collections/btree/set.rs +++ b/alloc/src/collections/btree/set.rs @@ -1132,6 +1132,7 @@ impl BTreeSet { /// 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() } } diff --git a/alloc/src/collections/vec_deque/mod.rs b/alloc/src/collections/vec_deque/mod.rs index 8c9db063105ce..a438517b75b9a 100644 --- a/alloc/src/collections/vec_deque/mod.rs +++ b/alloc/src/collections/vec_deque/mod.rs @@ -1201,6 +1201,7 @@ impl VecDeque { /// 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()) diff --git a/core/src/iter/traits/iterator.rs b/core/src/iter/traits/iterator.rs index 8352486ad416e..f53beeb007d1f 100644 --- a/core/src/iter/traits/iterator.rs +++ b/core/src/iter/traits/iterator.rs @@ -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

(self, predicate: P) -> Filter where Self: Sized, @@ -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 where Self: Sized + Iterator, @@ -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 where Self: Sized + Iterator, diff --git a/core/src/slice/mod.rs b/core/src/slice/mod.rs index b1948ce69c77d..cdcca0eee888d 100644 --- a/core/src/slice/mod.rs +++ b/core/src/slice/mod.rs @@ -1010,6 +1010,7 @@ impl [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) } diff --git a/core/src/str/mod.rs b/core/src/str/mod.rs index e947686487e06..9373d807f44e3 100644 --- a/core/src/str/mod.rs +++ b/core/src/str/mod.rs @@ -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() } } diff --git a/std/src/collections/hash/set.rs b/std/src/collections/hash/set.rs index d611353b0d3f2..e63d90645f777 100644 --- a/std/src/collections/hash/set.rs +++ b/std/src/collections/hash/set.rs @@ -187,6 +187,7 @@ impl HashSet { #[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() } }