fn check_attributes(&self, attrs: &[ast::Attribute], call: &MacCall) {
        let features = self.cx.ecfg.features.unwrap();
        let mut attrs = attrs.iter().peekable();
        let mut span: Option<Span> = None;
        while let Some(attr) = attrs.next() {
            rustc_ast_passes::feature_gate::check_attribute(attr, self.cx.sess, features);
            validate_attr::check_meta(&self.cx.sess.parse_sess, attr);

            let current_span = if let Some(sp) = span { sp.to(attr.span) } else { attr.span };
            span = Some(current_span);

            if attrs.peek().map_or(false, |next_attr| next_attr.doc_str().is_some()) {
                continue;
            }

            if attr.is_doc_comment() {
                self.cx.sess.parse_sess.buffer_lint_with_diagnostic(
                    &UNUSED_DOC_COMMENTS,
                    current_span,
                    self.cx.current_expansion.lint_node_id,
                    "unused doc comment",
                    BuiltinLintDiagnostics::UnusedDocComment(attr.span),
                );
            } else if rustc_attr::is_builtin_attr(attr) {
                let attr_name = attr.ident().unwrap().name;
                // `#[cfg]` and `#[cfg_attr]` are special - they are
                // eagerly evaluated.
                if attr_name != sym::cfg && attr_name != sym::cfg_attr {
                    self.cx.sess.parse_sess.buffer_lint_with_diagnostic(
                        &UNUSED_ATTRIBUTES,
                        attr.span,
                        self.cx.current_expansion.lint_node_id,
                        &format!("unused attribute `{}`", attr_name),
                        BuiltinLintDiagnostics::UnusedBuiltinAttribute {
                            attr_name,
                            macro_name: pprust::path_to_string(&call.path),
                            invoc_span: call.path.span,
                        },
                    );
                }
            }
        }
    }
// Detect use of feature-gated or invalid attributes on macro invocations
// since they will not be detected after macro expansion.
Detect use of feature-gated or invalid attributes on macro invocations
since they will not be detected after macro expansion.
Detect use of feature - gated or invalid attributes on macro invocations since they will not be detected after macro expansion .
fn check_attributes(&self, attrs: &[ast::Attribute], call: &MacCall) {
        let features = self.cx.ecfg.features.unwrap();
        let mut attrs = attrs.iter().peekable();
        let mut span: Option<Span> = None;
        while let Some(attr) = attrs.next() {
            rustc_ast_passes::feature_gate::check_attribute(attr, self.cx.sess, features);
            validate_attr::check_meta(&self.cx.sess.parse_sess, attr);
            let current_span = if let Some(sp) = span { sp.to(attr.span) } else { attr.span };
            span = Some(current_span);
            if attrs.peek().map_or(false, |next_attr| next_attr.doc_str().is_some()) {
                continue;
            }
            if attr.is_doc_comment() {
                self.cx.sess.parse_sess.buffer_lint_with_diagnostic(
                    &UNUSED_DOC_COMMENTS,
                    current_span,
                    self.cx.current_expansion.lint_node_id,
                    "unused doc comment",
                    BuiltinLintDiagnostics::UnusedDocComment(attr.span),
                );
            } else if rustc_attr::is_builtin_attr(attr) {
                let attr_name = attr.ident().unwrap().name;
                // `#[cfg]` and `#[cfg_attr]` are special - they are
                // eagerly evaluated.
                if attr_name != sym::cfg && attr_name != sym::cfg_attr {
                    self.cx.sess.parse_sess.buffer_lint_with_diagnostic(
                        &UNUSED_ATTRIBUTES,
                        attr.span,
                        self.cx.current_expansion.lint_node_id,
                        &format!("unused attribute `{}`", attr_name),
                        BuiltinLintDiagnostics::UnusedBuiltinAttribute {
                            attr_name,
                            macro_name: pprust::path_to_string(&call.path),
                            invoc_span: call.path.span,
                        },
                    );
                }
            }
        }
    }
fn check_attributes ( & self , attrs : & [ ast :: Attribute ] , call : & MacCall ) { let features = self . cx . ecfg . features . unwrap ( ) ; let mut attrs = attrs . iter ( ) . peekable ( ) ; let mut span : Option < Span > = None ; while let Some ( attr ) = attrs . next ( ) { rustc_ast_passes :: feature_gate :: check_attribute ( attr , self . cx . sess , features ) ; validate_attr :: check_meta ( & self . cx . sess . parse_sess , attr ) ; let current_span = if let Some ( sp ) = span { sp . to ( attr . span ) } else { attr . span } ; span = Some ( current_span ) ; if attrs . peek ( ) . map_or ( false , | next_attr | next_attr . doc_str ( ) . is_some ( ) ) { continue ; } if attr . is_doc_comment ( ) { self . cx . sess . parse_sess . buffer_lint_with_diagnostic ( & UNUSED_DOC_COMMENTS , current_span , self . cx . current_expansion . lint_node_id , " " , BuiltinLintDiagnostics :: UnusedDocComment ( attr . span ) , ) ; } else if rustc_attr :: is_builtin_attr ( attr ) { let attr_name = attr . ident ( ) . unwrap ( ) . name ; // `#[cfg]` and `#[cfg_attr]` are special - they are // eagerly evaluated. if attr_name != sym :: cfg && attr_name != sym :: cfg_attr { self . cx . sess . parse_sess . buffer_lint_with_diagnostic ( & UNUSED_ATTRIBUTES , attr . span , self . cx . current_expansion . lint_node_id , & format ! ( " " attr_name ) , BuiltinLintDiagnostics :: UnusedBuiltinAttribute { attr_name , macro_name : pprust :: path_to_string ( & call . path ) , invoc_span : call . path . span , } , ) ; } } } }
Detect use of feature-gated or invalid attributes on macro invocations
since they will not be detected after macro expansion.
Detect use of feature - gated or invalid attributes on macro invocations since they will not be detected after macro expansion .
&self
attrs
&[ast::Attribute]
call
&MacCall
&self
attrs
&[ast::Attribute]
call
&MacCall