1
Fork 0

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

View file

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

View file

@ -14,6 +14,7 @@ use Entry::*;
/// ///
/// [`entry`]: BTreeMap::entry /// [`entry`]: BTreeMap::entry
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeEntry")]
pub enum Entry<'a, K: 'a, V: 'a> { pub enum Entry<'a, K: 'a, V: 'a> {
/// A vacant entry. /// A vacant entry.
#[stable(feature = "rust1", since = "1.0.0")] #[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, // 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). // but we would likely want to indicate as such in documentation).
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Any")]
pub trait Any: 'static { pub trait Any: 'static {
/// Gets the `TypeId` of `self`. /// Gets the `TypeId` of `self`.
/// ///

View file

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

View file

@ -36,6 +36,7 @@ use crate::ops::{ControlFlow, Try};
/// assert_eq!(None, iter.next_back()); /// assert_eq!(None, iter.next_back());
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "DoubleEndedIterator")]
pub trait DoubleEndedIterator: Iterator { pub trait DoubleEndedIterator: Iterator {
/// Removes and returns an element from the end of the 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. /// crate to do so.
#[stable(feature = "duration", since = "1.3.0")] #[stable(feature = "duration", since = "1.3.0")]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[cfg_attr(not(test), rustc_diagnostic_item = "Duration")]
pub struct Duration { pub struct Duration {
secs: u64, secs: u64,
nanos: u32, // Always 0 <= nanos < NANOS_PER_SEC 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 /// [`entry`]: HashMap::entry
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "HashMapEntry")]
pub enum Entry<'a, K: 'a, V: 'a> { pub enum Entry<'a, K: 'a, V: 'a> {
/// An occupied entry. /// An occupied entry.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]

View file

@ -88,6 +88,7 @@ use crate::time::SystemTime;
/// [`BufReader<R>`]: io::BufReader /// [`BufReader<R>`]: io::BufReader
/// [`sync_all`]: File::sync_all /// [`sync_all`]: File::sync_all
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "File")]
pub struct File { pub struct File {
inner: fs_imp::File, inner: fs_imp::File,
} }
@ -183,12 +184,14 @@ pub struct Permissions(fs_imp::FilePermissions);
/// It is returned by [`Metadata::file_type`] method. /// It is returned by [`Metadata::file_type`] method.
#[stable(feature = "file_type", since = "1.1.0")] #[stable(feature = "file_type", since = "1.1.0")]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(not(test), rustc_diagnostic_item = "FileType")]
pub struct FileType(fs_imp::FileType); pub struct FileType(fs_imp::FileType);
/// A builder used to create directories in various manners. /// A builder used to create directories in various manners.
/// ///
/// This builder also supports platform-specific options. /// This builder also supports platform-specific options.
#[stable(feature = "dir_builder", since = "1.6.0")] #[stable(feature = "dir_builder", since = "1.6.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "DirBuilder")]
#[derive(Debug)] #[derive(Debug)]
pub struct DirBuilder { pub struct DirBuilder {
inner: fs_imp::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 /// [`File`]: crate::fs::File
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(notable_trait)] #[doc(notable_trait)]
#[cfg_attr(not(test), rustc_diagnostic_item = "IoRead")]
pub trait Read { pub trait Read {
/// Pull some bytes from this source into the specified buffer, returning /// Pull some bytes from this source into the specified buffer, returning
/// how many bytes were read. /// how many bytes were read.
@ -1361,6 +1362,7 @@ impl Initializer {
/// [`write_all`]: Write::write_all /// [`write_all`]: Write::write_all
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(notable_trait)] #[doc(notable_trait)]
#[cfg_attr(not(test), rustc_diagnostic_item = "IoWrite")]
pub trait Write { pub trait Write {
/// Write a buffer into this writer, returning how many bytes were written. /// Write a buffer into this writer, returning how many bytes were written.
/// ///