Rollup merge of #87170 - xFrednet:clippy-5393-add-diagnostic-items, r=Manishearth,oli-obk
Add diagnostic items for Clippy
This adds a bunch of diagnostic items to `std`/`core`/`alloc` functions, structs and traits used in Clippy. The actual refactorings in Clippy to use these items will be done in a different PR in Clippy after the next sync.
This PR doesn't include all paths Clippy uses, I've only gone through the first 85 lines of Clippy's [`paths.rs`](ecf85f4bdc/clippy_utils/src/paths.rs) (after rust-lang/rust-clippy#7466) to get some feedback early on. I've also decided against adding diagnostic items to methods, as it would be nicer and more scalable to access them in a nicer fashion, like adding a `is_diagnostic_assoc_item(did, sym::Iterator, sym::map)` function or something similar (Suggested by `@camsteffen` [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F/near/225024603))
There seems to be some different naming conventions when it comes to diagnostic items, some use UpperCamelCase (`BinaryHeap`) and some snake_case (`hashmap_type`). This PR uses UpperCamelCase for structs and traits and snake_case with the module name as a prefix for functions. Any feedback on is this welcome.
cc: rust-lang/rust-clippy#5393
r? `@Manishearth`
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user