Skip to content

Commit d38f2b0

Browse files
committed
Added diagnostic items to structs and traits for Clippy
1 parent 1a90004 commit d38f2b0

File tree

10 files changed

+26
-0
lines changed

10 files changed

+26
-0
lines changed

compiler/rustc_span/src/symbol.rs

+13
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,14 @@ symbols! {
122122
// nice to have.
123123
Symbols {
124124
Alignment,
125+
Any,
125126
Arc,
126127
Argument,
127128
ArgumentV1,
128129
Arguments,
130+
AsMut,
131+
AsRef,
132+
BTreeEntry,
129133
BTreeMap,
130134
BTreeSet,
131135
BinaryHeap,
@@ -139,19 +143,25 @@ symbols! {
139143
Continue,
140144
Copy,
141145
Count,
146+
Cow,
142147
Debug,
143148
DebugStruct,
144149
DebugTuple,
145150
Decodable,
146151
Decoder,
147152
Default,
148153
Deref,
154+
DirBuilder,
155+
DoubleEndedIterator,
156+
Duration,
149157
Encodable,
150158
Encoder,
151159
Eq,
152160
Equal,
153161
Err,
154162
Error,
163+
File,
164+
FileType,
155165
FormatSpec,
156166
Formatter,
157167
From,
@@ -164,9 +174,12 @@ symbols! {
164174
HashMap,
165175
HashSet,
166176
Hasher,
177+
HashMapEntry,
167178
Implied,
168179
Input,
169180
IntoIterator,
181+
IoRead,
182+
IoWrite,
170183
Is,
171184
ItemContext,
172185
Iterator,

library/alloc/src/borrow.rs

+1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ where
177177
/// }
178178
/// ```
179179
#[stable(feature = "rust1", since = "1.0.0")]
180+
#[cfg_attr(not(test), rustc_diagnostic_item = "Cow")]
180181
pub enum Cow<'a, B: ?Sized + 'a>
181182
where
182183
B: ToOwned,

library/alloc/src/collections/btree/map/entry.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use Entry::*;
1414
///
1515
/// [`entry`]: BTreeMap::entry
1616
#[stable(feature = "rust1", since = "1.0.0")]
17+
#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeEntry")]
1718
pub enum Entry<'a, K: 'a, V: 'a> {
1819
/// A vacant entry.
1920
#[stable(feature = "rust1", since = "1.0.0")]

library/core/src/any.rs

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ use crate::intrinsics;
108108
// unsafe traits and unsafe methods (i.e., `type_id` would still be safe to call,
109109
// but we would likely want to indicate as such in documentation).
110110
#[stable(feature = "rust1", since = "1.0.0")]
111+
#[cfg_attr(not(test), rustc_diagnostic_item = "Any")]
111112
pub trait Any: 'static {
112113
/// Gets the `TypeId` of `self`.
113114
///

library/core/src/convert/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ pub const fn identity<T>(x: T) -> T {
152152
/// is_hello(s);
153153
/// ```
154154
#[stable(feature = "rust1", since = "1.0.0")]
155+
#[cfg_attr(not(test), rustc_diagnostic_item = "AsRef")]
155156
pub trait AsRef<T: ?Sized> {
156157
/// Performs the conversion.
157158
#[stable(feature = "rust1", since = "1.0.0")]
@@ -193,6 +194,7 @@ pub trait AsRef<T: ?Sized> {
193194
///
194195
/// [`Box<T>`]: ../../std/boxed/struct.Box.html
195196
#[stable(feature = "rust1", since = "1.0.0")]
197+
#[cfg_attr(not(test), rustc_diagnostic_item = "AsMut")]
196198
pub trait AsMut<T: ?Sized> {
197199
/// Performs the conversion.
198200
#[stable(feature = "rust1", since = "1.0.0")]

library/core/src/iter/traits/double_ended.rs

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use crate::ops::{ControlFlow, Try};
3636
/// assert_eq!(None, iter.next_back());
3737
/// ```
3838
#[stable(feature = "rust1", since = "1.0.0")]
39+
#[cfg_attr(not(test), rustc_diagnostic_item = "DoubleEndedIterator")]
3940
pub trait DoubleEndedIterator: Iterator {
4041
/// Removes and returns an element from the end of the iterator.
4142
///

library/core/src/time.rs

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const MICROS_PER_SEC: u64 = 1_000_000;
6161
/// crate to do so.
6262
#[stable(feature = "duration", since = "1.3.0")]
6363
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
64+
#[cfg_attr(not(test), rustc_diagnostic_item = "Duration")]
6465
pub struct Duration {
6566
secs: u64,
6667
nanos: u32, // Always 0 <= nanos < NANOS_PER_SEC

library/std/src/collections/hash/map.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1829,6 +1829,7 @@ impl<K, V, S> Debug for RawEntryBuilder<'_, K, V, S> {
18291829
///
18301830
/// [`entry`]: HashMap::entry
18311831
#[stable(feature = "rust1", since = "1.0.0")]
1832+
#[cfg_attr(not(test), rustc_diagnostic_item = "HashMapEntry")]
18321833
pub enum Entry<'a, K: 'a, V: 'a> {
18331834
/// An occupied entry.
18341835
#[stable(feature = "rust1", since = "1.0.0")]

library/std/src/fs.rs

+3
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ use crate::time::SystemTime;
8888
/// [`BufReader<R>`]: io::BufReader
8989
/// [`sync_all`]: File::sync_all
9090
#[stable(feature = "rust1", since = "1.0.0")]
91+
#[cfg_attr(not(test), rustc_diagnostic_item = "File")]
9192
pub struct File {
9293
inner: fs_imp::File,
9394
}
@@ -183,12 +184,14 @@ pub struct Permissions(fs_imp::FilePermissions);
183184
/// It is returned by [`Metadata::file_type`] method.
184185
#[stable(feature = "file_type", since = "1.1.0")]
185186
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
187+
#[cfg_attr(not(test), rustc_diagnostic_item = "FileType")]
186188
pub struct FileType(fs_imp::FileType);
187189

188190
/// A builder used to create directories in various manners.
189191
///
190192
/// This builder also supports platform-specific options.
191193
#[stable(feature = "dir_builder", since = "1.6.0")]
194+
#[cfg_attr(not(test), rustc_diagnostic_item = "DirBuilder")]
192195
#[derive(Debug)]
193196
pub struct DirBuilder {
194197
inner: fs_imp::DirBuilder,

library/std/src/io/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ pub(crate) fn default_read_exact<R: Read + ?Sized>(this: &mut R, mut buf: &mut [
514514
/// [`File`]: crate::fs::File
515515
#[stable(feature = "rust1", since = "1.0.0")]
516516
#[doc(notable_trait)]
517+
#[cfg_attr(not(test), rustc_diagnostic_item = "IoRead")]
517518
pub trait Read {
518519
/// Pull some bytes from this source into the specified buffer, returning
519520
/// how many bytes were read.
@@ -1361,6 +1362,7 @@ impl Initializer {
13611362
/// [`write_all`]: Write::write_all
13621363
#[stable(feature = "rust1", since = "1.0.0")]
13631364
#[doc(notable_trait)]
1365+
#[cfg_attr(not(test), rustc_diagnostic_item = "IoWrite")]
13641366
pub trait Write {
13651367
/// Write a buffer into this writer, returning how many bytes were written.
13661368
///

0 commit comments

Comments
 (0)