]> git.lizzy.rs Git - rust.git/commitdiff
More diagnostic items for Clippy usage
authorPhilipp Hansch <dev@phansch.net>
Wed, 22 Apr 2020 05:47:31 +0000 (07:47 +0200)
committerPhilipp Hansch <dev@phansch.net>
Wed, 22 Apr 2020 05:57:56 +0000 (07:57 +0200)
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.

src/liballoc/collections/vec_deque.rs
src/liballoc/string.rs
src/libstd/collections/hash/map.rs
src/libstd/collections/hash/set.rs
src/libstd/sync/mutex.rs

index 091b068b0b2459cf2950fe679b4f3d4f08e49963..a3b61f1f4a5892fa436fcde9d34d96a4b611a579 100644 (file)
@@ -50,6 +50,7 @@
 /// [`pop_front`]: #method.pop_front
 /// [`extend`]: #method.extend
 /// [`append`]: #method.append
+#[cfg_attr(not(test), rustc_diagnostic_item = "vecdeque_type")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct VecDeque<T> {
     // tail and head are pointers into the buffer. Tail always points
index 80fa813991567881ee7549682d2dccd43cbc753e..f3fe1adebb141d4dd3c1b91b2c42e304825e3112 100644 (file)
 /// [`Deref`]: ../../std/ops/trait.Deref.html
 /// [`as_str()`]: struct.String.html#method.as_str
 #[derive(PartialOrd, Eq, Ord)]
+#[cfg_attr(not(test), rustc_diagnostic_item = "string_type")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct String {
     vec: Vec<u8>,
index 706b388f7832331c3cf86813ad474dedf2fa3ad8..e6da7426eb4afc08a88d7a2d12572ef17986a367 100644 (file)
 /// ```
 
 #[derive(Clone)]
+#[cfg_attr(not(test), rustc_diagnostic_item = "hashmap_type")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct HashMap<K, V, S = RandomState> {
     base: base::HashMap<K, V, S>,
index 1ad99f03703dd2da15616898a956d59b99d2efb2..c1a57f2ce6129b27b74426136ee7afeee210ca4b 100644 (file)
 /// [`PartialEq`]: ../../std/cmp/trait.PartialEq.html
 /// [`RefCell`]: ../../std/cell/struct.RefCell.html
 #[derive(Clone)]
+#[cfg_attr(not(test), rustc_diagnostic_item = "hashset_type")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct HashSet<T, S = RandomState> {
     map: HashMap<T, (), S>,
index 0cb16b19d7326767cb2282cd74edfea3489f66d0..797b22fdd1279ca931234284192bac2e2e4ddc02 100644 (file)
 /// *guard += 1;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "mutex_type")]
 pub struct Mutex<T: ?Sized> {
     // Note that this mutex is in a *box*, not inlined into the struct itself.
     // Once a native mutex has been used once, its address can never change (it