Skip to content

Fix libsyntax breaking changes caused by rust-lang/rust#65750 #4787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,11 @@ fn check_attrs(cx: &LateContext<'_, '_>, span: Span, name: Name, attrs: &[Attrib
}

for attr in attrs {
if attr.is_sugared_doc {
if attr.is_doc_comment() {
return;
}
if attr.style == AttrStyle::Outer {
if attr.tokens.is_empty() || !is_present_in_source(cx, attr.span) {
if attr.get_normal_item().tokens.is_empty() || !is_present_in_source(cx, attr.span) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ pub fn check_attrs<'a>(cx: &LateContext<'_, '_>, valid_idents: &FxHashSet<String
let mut spans = vec![];

for attr in attrs {
if attr.is_sugared_doc {
if attr.is_doc_comment() {
if let Some(ref current) = attr.value_str() {
let current = current.to_string();
let (current, current_spans) = strip_doc_comment_decoration(&current, attr.span);
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/main_recursion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl_lint_pass!(MainRecursion => [MAIN_RECURSION]);

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

fn check_expr_post(&mut self, cx: &LateContext<'_, '_>, expr: &Expr) {
Expand Down
5 changes: 4 additions & 1 deletion clippy_lints/src/utils/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ pub fn get_attr<'a>(
name: &'static str,
) -> impl Iterator<Item = &'a ast::Attribute> {
attrs.iter().filter(move |attr| {
let attr_segments = &attr.path.segments;
if attr.is_doc_comment() {
return false;
}
let attr_segments = &attr.get_normal_item().path.segments;
if attr_segments.len() == 2 && attr_segments[0].ident.to_string() == "clippy" {
if let Some(deprecation_status) =
BUILTIN_ATTRIBUTES
Expand Down