Fully integrate token collection for additional AST structs
This commit contains miscellaneous changes that don't fit into any of the other commits in this PR
This commit is contained in:
parent
961f18317d
commit
8808dc6abf
@ -285,7 +285,7 @@ fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if item.vis.node.is_pub() {
|
if item.vis.kind.is_pub() {
|
||||||
let matching = partial_match(mod_camel, &item_camel);
|
let matching = partial_match(mod_camel, &item_camel);
|
||||||
let rmatching = partial_rmatch(mod_camel, &item_camel);
|
let rmatching = partial_rmatch(mod_camel, &item_camel);
|
||||||
let nchars = mod_camel.chars().count();
|
let nchars = mod_camel.chars().count();
|
||||||
@ -316,7 +316,7 @@ fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let ItemKind::Enum(ref def, _) = item.kind {
|
if let ItemKind::Enum(ref def, _) = item.kind {
|
||||||
let lint = match item.vis.node {
|
let lint = match item.vis.kind {
|
||||||
VisibilityKind::Public => PUB_ENUM_VARIANT_NAMES,
|
VisibilityKind::Public => PUB_ENUM_VARIANT_NAMES,
|
||||||
_ => ENUM_VARIANT_NAMES,
|
_ => ENUM_VARIANT_NAMES,
|
||||||
};
|
};
|
||||||
|
@ -122,7 +122,7 @@ fn is_doc_hidden(attr: &Attribute) -> bool {
|
|||||||
|
|
||||||
fn check_manual_non_exhaustive_struct(cx: &EarlyContext<'_>, item: &Item, data: &VariantData) {
|
fn check_manual_non_exhaustive_struct(cx: &EarlyContext<'_>, item: &Item, data: &VariantData) {
|
||||||
fn is_private(field: &StructField) -> bool {
|
fn is_private(field: &StructField) -> bool {
|
||||||
matches!(field.vis.node, VisibilityKind::Inherited)
|
matches!(field.vis.kind, VisibilityKind::Inherited)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_non_exhaustive_marker(field: &StructField) -> bool {
|
fn is_non_exhaustive_marker(field: &StructField) -> bool {
|
||||||
@ -141,7 +141,7 @@ fn find_header_span(cx: &EarlyContext<'_>, item: &Item, data: &VariantData) -> S
|
|||||||
|
|
||||||
let fields = data.fields();
|
let fields = data.fields();
|
||||||
let private_fields = fields.iter().filter(|f| is_private(f)).count();
|
let private_fields = fields.iter().filter(|f| is_private(f)).count();
|
||||||
let public_fields = fields.iter().filter(|f| f.vis.node.is_pub()).count();
|
let public_fields = fields.iter().filter(|f| f.vis.kind.is_pub()).count();
|
||||||
|
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if private_fields == 1 && public_fields >= 1 && public_fields == fields.len() - 1;
|
if private_fields == 1 && public_fields >= 1 && public_fields == fields.len() - 1;
|
||||||
|
@ -41,7 +41,7 @@ fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
|
|||||||
if_chain! {
|
if_chain! {
|
||||||
if !in_macro(item.span);
|
if !in_macro(item.span);
|
||||||
if cx.sess.opts.edition == Edition::Edition2018;
|
if cx.sess.opts.edition == Edition::Edition2018;
|
||||||
if !item.vis.node.is_pub();
|
if !item.vis.kind.is_pub();
|
||||||
if let ItemKind::Use(use_tree) = &item.kind;
|
if let ItemKind::Use(use_tree) = &item.kind;
|
||||||
if let segments = &use_tree.prefix.segments;
|
if let segments = &use_tree.prefix.segments;
|
||||||
if segments.len() == 1;
|
if segments.len() == 1;
|
||||||
|
@ -392,7 +392,7 @@ pub fn eq_defaultness(l: Defaultness, r: Defaultness) -> bool {
|
|||||||
|
|
||||||
pub fn eq_vis(l: &Visibility, r: &Visibility) -> bool {
|
pub fn eq_vis(l: &Visibility, r: &Visibility) -> bool {
|
||||||
use VisibilityKind::*;
|
use VisibilityKind::*;
|
||||||
match (&l.node, &r.node) {
|
match (&l.kind, &r.kind) {
|
||||||
(Public, Public) | (Inherited, Inherited) | (Crate(_), Crate(_)) => true,
|
(Public, Public) | (Inherited, Inherited) | (Crate(_), Crate(_)) => true,
|
||||||
(Restricted { path: l, .. }, Restricted { path: r, .. }) => eq_path(l, r),
|
(Restricted { path: l, .. }, Restricted { path: r, .. }) => eq_path(l, r),
|
||||||
_ => false,
|
_ => false,
|
||||||
|
Loading…
Reference in New Issue
Block a user