Skip to content

Commit ff7636d

Browse files
committed
Split out ast::ItemKind::Const into its own struct
1 parent 929696d commit ff7636d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clippy_lints/src/redundant_static_lifetimes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
22
use clippy_utils::msrvs::{self, Msrv};
33
use clippy_utils::source::snippet;
4-
use rustc_ast::ast::{Item, ItemKind, Ty, TyKind, Static};
4+
use rustc_ast::ast::{Item, ItemKind, Ty, TyKind, Static, ConstItem};
55
use rustc_errors::Applicability;
66
use rustc_lint::{EarlyContext, EarlyLintPass};
77
use rustc_session::{declare_tool_lint, impl_lint_pass};
@@ -100,7 +100,7 @@ impl EarlyLintPass for RedundantStaticLifetimes {
100100
}
101101

102102
if !item.span.from_expansion() {
103-
if let ItemKind::Const(_, ref var_type, _) = item.kind {
103+
if let ItemKind::Const(ConstItem { ty: ref var_type, .. }) = item.kind {
104104
Self::visit_type(var_type, cx, "constants have by default a `'static` lifetime");
105105
// Don't check associated consts because `'static` cannot be elided on those (issue
106106
// #2438)

clippy_utils/src/ast_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
287287
(ExternCrate(l), ExternCrate(r)) => l == r,
288288
(Use(l), Use(r)) => eq_use_tree(l, r),
289289
(Static(ast::Static{ ty: lt, mutability: lm, expr: le}), Static(ast::Static { ty: rt, mutability: rm, expr: re})) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
290-
(Const(ld, lt, le), Const(rd, rt, re)) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
290+
(Const(ast::ConstItem { defaultness: ld, ty: lt, expr: le}), Const(ast::ConstItem { defaultness: rd, ty: rt, expr: re} )) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
291291
(
292292
Fn(box ast::Fn {
293293
defaultness: ld,
@@ -451,7 +451,7 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
451451
pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
452452
use AssocItemKind::*;
453453
match (l, r) {
454-
(Const(ld, lt, le), Const(rd, rt, re)) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
454+
(Const(ast::ConstItem { defaultness: ld, ty: lt, expr: le}), Const(ast::ConstItem { defaultness: rd, ty: rt, expr: re})) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
455455
(
456456
Fn(box ast::Fn {
457457
defaultness: ld,

0 commit comments

Comments
 (0)