Skip to content

Commit e12c00d

Browse files
committed
Fix libsyntax breaking changes caused by rust-lang/rust#65750
1 parent 43a3796 commit e12c00d

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

clippy_lints/src/attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,11 @@ fn check_attrs(cx: &LateContext<'_, '_>, span: Span, name: Name, attrs: &[Attrib
417417
}
418418

419419
for attr in attrs {
420-
if attr.is_sugared_doc {
420+
if attr.is_doc_comment() {
421421
return;
422422
}
423423
if attr.style == AttrStyle::Outer {
424-
if attr.tokens.is_empty() || !is_present_in_source(cx, attr.span) {
424+
if attr.get_normal_item().tokens.is_empty() || !is_present_in_source(cx, attr.span) {
425425
return;
426426
}
427427

clippy_lints/src/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ pub fn check_attrs<'a>(cx: &LateContext<'_, '_>, valid_idents: &FxHashSet<String
247247
let mut spans = vec![];
248248

249249
for attr in attrs {
250-
if attr.is_sugared_doc {
250+
if attr.is_doc_comment() {
251251
if let Some(ref current) = attr.value_str() {
252252
let current = current.to_string();
253253
let (current, current_spans) = strip_doc_comment_decoration(&current, attr.span);

clippy_lints/src/main_recursion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl_lint_pass!(MainRecursion => [MAIN_RECURSION]);
3434

3535
impl LateLintPass<'_, '_> for MainRecursion {
3636
fn check_crate(&mut self, _: &LateContext<'_, '_>, krate: &Crate) {
37-
self.has_no_std_attr = krate.attrs.iter().any(|attr| attr.path == sym::no_std);
37+
self.has_no_std_attr = krate.attrs.iter().any(|attr| attr.has_name(sym::no_std));
3838
}
3939

4040
fn check_expr_post(&mut self, cx: &LateContext<'_, '_>, expr: &Expr) {

clippy_lints/src/utils/attrs.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ pub fn get_attr<'a>(
5757
name: &'static str,
5858
) -> impl Iterator<Item = &'a ast::Attribute> {
5959
attrs.iter().filter(move |attr| {
60-
let attr_segments = &attr.path.segments;
60+
if attr.is_doc_comment() {
61+
return false;
62+
}
63+
let attr_segments = &attr.get_normal_item().path.segments;
6164
if attr_segments.len() == 2 && attr_segments[0].ident.to_string() == "clippy" {
6265
if let Some(deprecation_status) =
6366
BUILTIN_ATTRIBUTES

0 commit comments

Comments
 (0)