1
Fork 0

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:
Yuki Okushi 2021-07-18 14:21:57 +09:00 committed by GitHub
commit 07faa2e32c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 44 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,
@ -162,11 +172,14 @@ symbols! {
GlobalAlloc,
Hash,
HashMap,
HashMapEntry,
HashSet,
Hasher,
Implied,
Input,
IntoIterator,
IoRead,
IoWrite,
Is,
ItemContext,
Iterator,
@ -369,6 +382,8 @@ symbols! {
closure,
closure_to_fn_coercion,
cmp,
cmp_max,
cmp_min,
cmpxchg16b_target_feature,
cmse_nonsecure_entry,
coerce_unsized,
@ -674,6 +689,7 @@ symbols! {
item,
item_like_imports,
iter,
iter_repeat,
keyword,
kind,
kreg,
@ -740,6 +756,12 @@ symbols! {
maybe_uninit,
maybe_uninit_uninit,
maybe_uninit_zeroed,
mem_discriminant,
mem_drop,
mem_forget,
mem_replace,
mem_size_of,
mem_size_of_val,
mem_uninitialized,
mem_zeroed,
member_constraints,