diff options
| author | bors <bors@rust-lang.org> | 2024-06-21 16:07:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-06-21 16:07:03 +0000 |
| commit | fe2fe7feed08fe0296e74a6352d367a40703cc30 (patch) | |
| tree | 384b5f0246a7182f03797ad95a9c0915f7af5538 /clippy_lints/src/missing_doc.rs | |
| parent | 3e84ca8ac95623bc5a36886873b12bd95fd8f700 (diff) | |
| parent | 4baae5d8b3f5b681097c5afe9ad3e1494f223b1b (diff) | |
Auto merge of #12972 - Jarcho:span_ex, r=Manishearth
Add new span related utils The none-generic versions of the functions exist to help with both compile times and codegen. changelog: None
Diffstat (limited to 'clippy_lints/src/missing_doc.rs')
| -rw-r--r-- | clippy_lints/src/missing_doc.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs index ca344dc5c81..250fd5cbd48 100644 --- a/clippy_lints/src/missing_doc.rs +++ b/clippy_lints/src/missing_doc.rs @@ -8,7 +8,7 @@ use clippy_utils::attrs::is_doc_hidden; use clippy_utils::diagnostics::span_lint; use clippy_utils::is_from_proc_macro; -use clippy_utils::source::snippet_opt; +use clippy_utils::source::SpanRangeExt; use rustc_ast::ast::{self, MetaItem, MetaItemKind}; use rustc_hir as hir; use rustc_hir::def_id::LocalDefId; @@ -266,8 +266,5 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc { } fn span_to_snippet_contains_docs(cx: &LateContext<'_>, search_span: Span) -> bool { - let Some(snippet) = snippet_opt(cx, search_span) else { - return false; - }; - snippet.lines().rev().any(|line| line.trim().starts_with("///")) + search_span.check_source_text(cx, |src| src.lines().rev().any(|line| line.trim().starts_with("///"))) } |
