about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-26 15:47:18 +0200
committerGitHub <noreply@github.com>2025-06-26 15:47:18 +0200
commit55d4f76c73ae517905df61674667463e65e90b47 (patch)
tree15252ea358424a58d0c3050c2ac4f4036219d9a5
parent708ffd5ccf3045819a5c773daf0c311950cae1e0 (diff)
parent7a6f7bc7a668aa309249ca7e8a4275f7fedce173 (diff)
downloadrust-55d4f76c73ae517905df61674667463e65e90b47.tar.gz
rust-55d4f76c73ae517905df61674667463e65e90b47.zip
Rollup merge of #141648 - GuillaumeGomez:redundant_explicit_links-expansion, r=lolbinarycat
[rustdoc] Do not emit redundant_explicit_links lint if the doc comment comes from expansion

Fixes https://github.com/rust-lang/rust/issues/141553.

The problem was that we change the context for the attributes in some cases to get better error output, preventing us to detect if the attribute comes from expansion. Most of the changes are about keeping track of the "does this span comes from expansion" information.

r? ```@Manishearth```
-rw-r--r--clippy_lints/src/doc/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/doc/mod.rs b/clippy_lints/src/doc/mod.rs
index e0fc2fd9347..d38588bb799 100644
--- a/clippy_lints/src/doc/mod.rs
+++ b/clippy_lints/src/doc/mod.rs
@@ -765,8 +765,8 @@ impl Fragments<'_> {
     /// get the span for the markdown range. Note that this function is not cheap, use it with
     /// caution.
     #[must_use]
-    fn span(&self, cx: &LateContext<'_>, range: Range<usize>) -> Option<Span> {
-        source_span_for_markdown_range(cx.tcx, self.doc, &range, self.fragments)
+    fn span(self, cx: &LateContext<'_>, range: Range<usize>) -> Option<Span> {
+        source_span_for_markdown_range(cx.tcx, self.doc, &range, self.fragments).map(|(sp, _)| sp)
     }
 }