]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #104006 - flip1995:lang-items-clippy, r=oli-obk
authorMatthias Krüger <matthias.krueger@famsik.de>
Fri, 18 Nov 2022 13:13:37 +0000 (14:13 +0100)
committerGitHub <noreply@github.com>
Fri, 18 Nov 2022 13:13:37 +0000 (14:13 +0100)
commit2ea012619ef6ac8782b57af57ca5f7e0f1fc4c84
tree0bd7414c542bae6dd410e51baa2c0e072fc535f3
parent6419151f8b0187849825afca91c6047fbf8930bf
parent4e65f5ea82aa8c128c4dc8611677019679a9bc67
Rollup merge of #104006 - flip1995:lang-items-clippy, r=oli-obk

Add variant_name function to `LangItem`

Clippy has an internal lint that checks for the usage of hardcoded def paths and suggests to replace them with a lang or diagnostic item, if possible. This was implemented with a hack, by getting all the variants of the `LangItem` enum and then index into it with the position of the `LangItem` in the `items` list. This is no longer possible, because the `items` list can't be accessed anymore.

Follow up to #103603

cc `@camsteffen`
r? `@oli-obk`

This is blocking the sync between Clippy and Rust. I'm not sure if this is the best solution here, or if I should add a method `items()` to `LanguageItems` and keep the code in Clippy unchanged.