Added diagnostic items to structs and traits for Clippy

This commit is contained in:
xFrednet 2021-07-15 23:51:34 +02:00
parent 1a900042ab
commit d38f2b0cc1
10 changed files with 26 additions and 0 deletions

View file

@ -122,10 +122,14 @@ symbols! {
// nice to have.
Symbols {
Alignment,
Any,
Arc,
Argument,
ArgumentV1,
Arguments,
AsMut,
AsRef,
BTreeEntry,
BTreeMap,
BTreeSet,
BinaryHeap,
@ -139,6 +143,7 @@ symbols! {
Continue,
Copy,
Count,
Cow,
Debug,
DebugStruct,
DebugTuple,
@ -146,12 +151,17 @@ symbols! {
Decoder,
Default,
Deref,
DirBuilder,
DoubleEndedIterator,
Duration,
Encodable,
Encoder,
Eq,
Equal,
Err,
Error,
File,
FileType,
FormatSpec,
Formatter,
From,
@ -164,9 +174,12 @@ symbols! {
HashMap,
HashSet,
Hasher,
HashMapEntry,
Implied,
Input,
IntoIterator,
IoRead,
IoWrite,
Is,
ItemContext,
Iterator,

View file

@ -177,6 +177,7 @@ where
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Cow")]
pub enum Cow<'a, B: ?Sized + 'a>
where
B: ToOwned,

View file

@ -14,6 +14,7 @@ use Entry::*;
///
/// [`entry`]: BTreeMap::entry
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeEntry")]
pub enum Entry<'a, K: 'a, V: 'a> {
/// A vacant entry.
#[stable(feature = "rust1", since = "1.0.0")]

View file

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

View file

@ -152,6 +152,7 @@ pub const fn identity<T>(x: T) -> T {
/// is_hello(s);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "AsRef")]
pub trait AsRef<T: ?Sized> {
/// Performs the conversion.
#[stable(feature = "rust1", since = "1.0.0")]
@ -193,6 +194,7 @@ pub trait AsRef<T: ?Sized> {
///
/// [`Box<T>`]: ../../std/boxed/struct.Box.html
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "AsMut")]
pub trait AsMut<T: ?Sized> {
/// Performs the conversion.
#[stable(feature = "rust1", since = "1.0.0")]

View file

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

View file

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

View file

@ -1829,6 +1829,7 @@ impl<K, V, S> Debug for RawEntryBuilder<'_, K, V, S> {
///
/// [`entry`]: HashMap::entry
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "HashMapEntry")]
pub enum Entry<'a, K: 'a, V: 'a> {
/// An occupied entry.
#[stable(feature = "rust1", since = "1.0.0")]

View file

@ -88,6 +88,7 @@ use crate::time::SystemTime;
/// [`BufReader<R>`]: io::BufReader
/// [`sync_all`]: File::sync_all
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "File")]
pub struct File {
inner: fs_imp::File,
}
@ -183,12 +184,14 @@ pub struct Permissions(fs_imp::FilePermissions);
/// It is returned by [`Metadata::file_type`] method.
#[stable(feature = "file_type", since = "1.1.0")]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(not(test), rustc_diagnostic_item = "FileType")]
pub struct FileType(fs_imp::FileType);
/// A builder used to create directories in various manners.
///
/// This builder also supports platform-specific options.
#[stable(feature = "dir_builder", since = "1.6.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "DirBuilder")]
#[derive(Debug)]
pub struct DirBuilder {
inner: fs_imp::DirBuilder,

View file

@ -514,6 +514,7 @@ pub(crate) fn default_read_exact<R: Read + ?Sized>(this: &mut R, mut buf: &mut [
/// [`File`]: crate::fs::File
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(notable_trait)]
#[cfg_attr(not(test), rustc_diagnostic_item = "IoRead")]
pub trait Read {
/// Pull some bytes from this source into the specified buffer, returning
/// how many bytes were read.
@ -1361,6 +1362,7 @@ impl Initializer {
/// [`write_all`]: Write::write_all
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(notable_trait)]
#[cfg_attr(not(test), rustc_diagnostic_item = "IoWrite")]
pub trait Write {
/// Write a buffer into this writer, returning how many bytes were written.
///