Skip to content

Commit

Permalink
Fix libsyntax breaking changes caused by rust-lang/rust#65750
Browse files Browse the repository at this point in the history
  • Loading branch information
msizanoen1 committed Nov 7, 2019
1 parent 43a3796 commit e12c00d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
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

0 comments on commit e12c00d

Please sign in to comment.