Do not collect tokens for doc comments

This commit is contained in:
Vadim Petrochenkov 2020-11-05 20:27:48 +03:00
parent 34244190d4
commit 8845f10e94
4 changed files with 4 additions and 4 deletions

View File

@ -588,7 +588,7 @@ impl EarlyLintPass for EarlyAttributes {
fn check_empty_line_after_outer_attr(cx: &EarlyContext<'_>, item: &rustc_ast::Item) {
for attr in &item.attrs {
let attr_item = if let AttrKind::Normal(ref attr) = attr.kind {
let attr_item = if let AttrKind::Normal(ref attr, _) = attr.kind {
attr
} else {
return;

View File

@ -509,7 +509,7 @@ pub fn eq_attr(l: &Attribute, r: &Attribute) -> bool {
l.style == r.style
&& match (&l.kind, &r.kind) {
(DocComment(l1, l2), DocComment(r1, r2)) => l1 == r1 && l2 == r2,
(Normal(l), Normal(r)) => eq_path(&l.path, &r.path) && eq_mac_args(&l.args, &r.args),
(Normal(l, _), Normal(r, _)) => eq_path(&l.path, &r.path) && eq_mac_args(&l.args, &r.args),
_ => false,
}
}

View File

@ -57,7 +57,7 @@ pub fn get_attr<'a>(
name: &'static str,
) -> impl Iterator<Item = &'a ast::Attribute> {
attrs.iter().filter(move |attr| {
let attr = if let ast::AttrKind::Normal(ref attr) = attr.kind {
let attr = if let ast::AttrKind::Normal(ref attr, _) = attr.kind {
attr
} else {
return false;

View File

@ -1349,7 +1349,7 @@ pub fn is_must_use_func_call(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
pub fn is_no_std_crate(krate: &Crate<'_>) -> bool {
krate.item.attrs.iter().any(|attr| {
if let ast::AttrKind::Normal(ref attr) = attr.kind {
if let ast::AttrKind::Normal(ref attr, _) = attr.kind {
attr.path == symbol::sym::no_std
} else {
false