diff --git a/.travis.yml b/.travis.yml index b07ebe501c76..a8d80453dab6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,8 +47,9 @@ matrix: fast_finish: true include: # Builds that are executed for every PR - - os: osx # run base tests on both platforms - os: linux + - os: osx + if: branch IN (auto, try) - os: windows env: CARGO_INCREMENTAL=0 OS_WINDOWS=true diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 2324693cdc98..deb91c269249 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -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; } diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index 726a044f9ed9..6777ebbfb69f 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -247,7 +247,7 @@ pub fn check_attrs<'a>(cx: &LateContext<'_, '_>, valid_idents: &FxHashSet [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.is_doc_comment() && attr.get_normal_item().path == sym::no_std); } fn check_expr_post(&mut self, cx: &LateContext<'_, '_>, expr: &Expr) { diff --git a/clippy_lints/src/utils/attrs.rs b/clippy_lints/src/utils/attrs.rs index 2520f366b327..969987300ef3 100644 --- a/clippy_lints/src/utils/attrs.rs +++ b/clippy_lints/src/utils/attrs.rs @@ -57,46 +57,50 @@ pub fn get_attr<'a>( name: &'static str, ) -> impl Iterator { attrs.iter().filter(move |attr| { - let attr_segments = &attr.path.segments; - if attr_segments.len() == 2 && attr_segments[0].ident.to_string() == "clippy" { - if let Some(deprecation_status) = - BUILTIN_ATTRIBUTES - .iter() - .find_map(|(builtin_name, deprecation_status)| { - if *builtin_name == attr_segments[1].ident.to_string() { - Some(deprecation_status) - } else { - None - } - }) - { - let mut db = sess.struct_span_err(attr_segments[1].ident.span, "Usage of deprecated attribute"); - match *deprecation_status { - DeprecationStatus::Deprecated => { - db.emit(); - false - }, - DeprecationStatus::Replaced(new_name) => { - db.span_suggestion( - attr_segments[1].ident.span, - "consider using", - new_name.to_string(), - Applicability::MachineApplicable, - ); - db.emit(); - false - }, - DeprecationStatus::None => { - db.cancel(); - attr_segments[1].ident.to_string() == name - }, + if attr.is_doc_comment() { + false + } else { + 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 + .iter() + .find_map(|(builtin_name, deprecation_status)| { + if *builtin_name == attr_segments[1].ident.to_string() { + Some(deprecation_status) + } else { + None + } + }) + { + let mut db = sess.struct_span_err(attr_segments[1].ident.span, "Usage of deprecated attribute"); + match *deprecation_status { + DeprecationStatus::Deprecated => { + db.emit(); + false + }, + DeprecationStatus::Replaced(new_name) => { + db.span_suggestion( + attr_segments[1].ident.span, + "consider using", + new_name.to_string(), + Applicability::MachineApplicable, + ); + db.emit(); + false + }, + DeprecationStatus::None => { + db.cancel(); + attr_segments[1].ident.to_string() == name + }, + } + } else { + sess.span_err(attr_segments[1].ident.span, "Usage of unknown attribute"); + false } } else { - sess.span_err(attr_segments[1].ident.span, "Usage of unknown attribute"); false } - } else { - false } }) }