use span of fragments

This commit is contained in:
lucarlig 2024-02-25 21:31:46 +04:00
parent d7ad85f521
commit f066be7e1e

View File

@ -1,17 +1,13 @@
use super::EMPTY_DOCS;
use clippy_utils::diagnostics::span_lint_and_help;
use rustc_ast::Attribute;
use rustc_lint::LateContext;
use super::EMPTY_DOCS;
use rustc_resolve::rustdoc::{attrs_to_doc_fragments, span_of_fragments};
// TODO: Adjust the parameters as necessary
pub(super) fn check(cx: &LateContext<'_>, attrs: &[Attribute]) {
let doc_attrs: Vec<_> = attrs.iter().filter(|attr| attr.doc_str().is_some()).collect();
let span;
if let Some(first) = doc_attrs.first()
&& let Some(last) = doc_attrs.last()
{
span = first.span.with_hi(last.span.hi());
let (fragments, _) = attrs_to_doc_fragments(attrs.iter().map(|attr| (attr, None)), true);
if let Some(span) = span_of_fragments(&fragments) {
span_lint_and_help(
cx,
EMPTY_DOCS,