Skip to content

Commit 01fdc88

Browse files
authored
Rollup merge of rust-lang#71414 - phansch:more-diagnostic-items, r=Manishearth
More diagnostic items for Clippy usage This adds a couple of more diagnostic items to be used in Clippy. I chose these particular ones because they were the types which we seem to check for the most in Clippy. I'm not sure if the `cfg_attr(not(test))` is needed, but it was also used for `Vec` and a few other types. cc rust-lang/rust-clippy#5393 r? @Manishearth
2 parents 91ef663 + 23b9f46 commit 01fdc88

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

src/liballoc/collections/vec_deque.rs

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const MAXIMUM_ZST_CAPACITY: usize = 1 << (64 - 1); // Largest possible power of
5050
/// [`pop_front`]: #method.pop_front
5151
/// [`extend`]: #method.extend
5252
/// [`append`]: #method.append
53+
#[cfg_attr(not(test), rustc_diagnostic_item = "vecdeque_type")]
5354
#[stable(feature = "rust1", since = "1.0.0")]
5455
pub struct VecDeque<T> {
5556
// tail and head are pointers into the buffer. Tail always points

src/liballoc/string.rs

+1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ use crate::vec::Vec;
278278
/// [`Deref`]: ../../std/ops/trait.Deref.html
279279
/// [`as_str()`]: struct.String.html#method.as_str
280280
#[derive(PartialOrd, Eq, Ord)]
281+
#[cfg_attr(not(test), rustc_diagnostic_item = "string_type")]
281282
#[stable(feature = "rust1", since = "1.0.0")]
282283
pub struct String {
283284
vec: Vec<u8>,

src/libstd/collections/hash/map.rs

+1
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ use crate::sys;
198198
/// ```
199199
200200
#[derive(Clone)]
201+
#[cfg_attr(not(test), rustc_diagnostic_item = "hashmap_type")]
201202
#[stable(feature = "rust1", since = "1.0.0")]
202203
pub struct HashMap<K, V, S = RandomState> {
203204
base: base::HashMap<K, V, S>,

src/libstd/collections/hash/set.rs

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ use super::map::{self, HashMap, Keys, RandomState};
105105
/// [`PartialEq`]: ../../std/cmp/trait.PartialEq.html
106106
/// [`RefCell`]: ../../std/cell/struct.RefCell.html
107107
#[derive(Clone)]
108+
#[cfg_attr(not(test), rustc_diagnostic_item = "hashset_type")]
108109
#[stable(feature = "rust1", since = "1.0.0")]
109110
pub struct HashSet<T, S = RandomState> {
110111
map: HashMap<T, (), S>,

src/libstd/sync/mutex.rs

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
108108
/// *guard += 1;
109109
/// ```
110110
#[stable(feature = "rust1", since = "1.0.0")]
111+
#[cfg_attr(not(test), rustc_diagnostic_item = "mutex_type")]
111112
pub struct Mutex<T: ?Sized> {
112113
// Note that this mutex is in a *box*, not inlined into the struct itself.
113114
// Once a native mutex has been used once, its address can never change (it

0 commit comments

Comments
 (0)