diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-06-22 08:49:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-22 08:49:05 +0200 |
| commit | bf63acfd3553fbd21e85e3eac3dd795d35fd0804 (patch) | |
| tree | c752c7744aa84547803687c0deb9489bc641846e /src | |
| parent | b5b106ab91ef614c0e6629df8e5f42a283746346 (diff) | |
| parent | 6729b667ce4b013a5ec6f50b096bde3edabc28e3 (diff) | |
| download | rust-bf63acfd3553fbd21e85e3eac3dd795d35fd0804.tar.gz rust-bf63acfd3553fbd21e85e3eac3dd795d35fd0804.zip | |
Rollup merge of #142776 - dtolnay:hirattrstyle2, r=jdonszelmann
All HIR attributes are outer Fixes https://github.com/rust-lang/rust/issues/142649. Closes https://github.com/rust-lang/rust/pull/142759. All HIR attributes, including parsed and not yet parsed, will now be rendered as outer attributes by `rustc_hir_pretty`. The original style of the corresponding AST attribute(s) is not relevant for pretty printing, only for diagnostics. r? ````@jdonszelmann````
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/doc/doc_suspicious_footnotes.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/tools/clippy/clippy_lints/src/doc/doc_suspicious_footnotes.rs b/src/tools/clippy/clippy_lints/src/doc/doc_suspicious_footnotes.rs index 289b6b915d4..d3c39686976 100644 --- a/src/tools/clippy/clippy_lints/src/doc/doc_suspicious_footnotes.rs +++ b/src/tools/clippy/clippy_lints/src/doc/doc_suspicious_footnotes.rs @@ -1,4 +1,5 @@ use clippy_utils::diagnostics::span_lint_and_then; +use rustc_ast::attr::AttributeExt as _; use rustc_ast::token::CommentKind; use rustc_errors::Applicability; use rustc_hir::{AttrStyle, Attribute}; @@ -43,13 +44,19 @@ pub fn check(cx: &LateContext<'_>, doc: &str, range: Range<usize>, fragments: &F "looks like a footnote ref, but has no matching footnote", |diag| { if this_fragment.kind == DocFragmentKind::SugaredDoc { - let (doc_attr, (_, doc_attr_comment_kind)) = attrs + let (doc_attr, (_, doc_attr_comment_kind), attr_style) = attrs .iter() .filter(|attr| attr.span().overlaps(this_fragment.span)) .rev() - .find_map(|attr| Some((attr, attr.doc_str_and_comment_kind()?))) + .find_map(|attr| { + Some(( + attr, + attr.doc_str_and_comment_kind()?, + attr.doc_resolution_scope()?, + )) + }) .unwrap(); - let (to_add, terminator) = match (doc_attr_comment_kind, doc_attr.style()) { + let (to_add, terminator) = match (doc_attr_comment_kind, attr_style) { (CommentKind::Line, AttrStyle::Outer) => ("\n///\n/// ", ""), (CommentKind::Line, AttrStyle::Inner) => ("\n//!\n//! ", ""), (CommentKind::Block, AttrStyle::Outer) => ("\n/** ", " */"), |
