Skip to content

Commit 425c3a0

Browse files
Rollup merge of #143279 - GuillaumeGomez:rm-itemkind-descr, r=oli-obk
Remove `ItemKind::descr` method Follow-up of rust-lang/rust#143234. After this PR is merged, it will remain two `descr` methods: * `hir::GenericArg::descr` * `hir::AssocItemConstraintKind::descr` For both these enums, I don't think there is the right equivalent in `hir::DefKind` so unless I missed something, we can't remove these two methods because we can't convert these enums into `hir::DefKind`. r? `@oli-obk`
2 parents dc70a5d + 69ef03d commit 425c3a0

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

clippy_lints/src/undocumented_unsafe_blocks.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,10 @@ impl<'tcx> LateLintPass<'tcx> for UndocumentedUnsafeBlocks {
256256
cx,
257257
UNNECESSARY_SAFETY_COMMENT,
258258
span,
259-
format!("{} has unnecessary safety comment", item.kind.descr()),
259+
format!(
260+
"{} has unnecessary safety comment",
261+
cx.tcx.def_descr(item.owner_id.to_def_id()),
262+
),
260263
|diag| {
261264
diag.span_help(help_span, "consider removing the safety comment");
262265
},
@@ -274,7 +277,10 @@ impl<'tcx> LateLintPass<'tcx> for UndocumentedUnsafeBlocks {
274277
cx,
275278
UNNECESSARY_SAFETY_COMMENT,
276279
span,
277-
format!("{} has unnecessary safety comment", item.kind.descr()),
280+
format!(
281+
"{} has unnecessary safety comment",
282+
cx.tcx.def_descr(item.owner_id.to_def_id()),
283+
),
278284
|diag| {
279285
diag.span_help(help_span, "consider removing the safety comment");
280286
},

tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.default.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ LL | unsafe impl TrailingComment for () {} // SAFETY:
240240
|
241241
= help: consider adding a safety comment on the preceding line
242242

243-
error: constant item has unnecessary safety comment
243+
error: constant has unnecessary safety comment
244244
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:508:5
245245
|
246246
LL | const BIG_NUMBER: i32 = 1000000;

tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.disabled.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ LL | unsafe impl TrailingComment for () {} // SAFETY:
240240
|
241241
= help: consider adding a safety comment on the preceding line
242242

243-
error: constant item has unnecessary safety comment
243+
error: constant has unnecessary safety comment
244244
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:508:5
245245
|
246246
LL | const BIG_NUMBER: i32 = 1000000;

tests/ui/unnecessary_safety_comment.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: constant item has unnecessary safety comment
1+
error: constant has unnecessary safety comment
22
--> tests/ui/unnecessary_safety_comment.rs:6:5
33
|
44
LL | const CONST: u32 = 0;
@@ -12,7 +12,7 @@ LL | // SAFETY:
1212
= note: `-D clippy::unnecessary-safety-comment` implied by `-D warnings`
1313
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_safety_comment)]`
1414

15-
error: static item has unnecessary safety comment
15+
error: static has unnecessary safety comment
1616
--> tests/ui/unnecessary_safety_comment.rs:10:5
1717
|
1818
LL | static STATIC: u32 = 0;

0 commit comments

Comments
 (0)