mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Rollup merge of #147676 - jdonszelmann:span-is-doc-comment, r=GuillaumeGomez
Return spans out of `is_doc_comment` to reduce reliance on `.span()` on attributes r? `@GuillaumeGomez`
This commit is contained in:
@@ -47,7 +47,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
|
||||
.tcx
|
||||
.hir_attrs(item.hir_id())
|
||||
.iter()
|
||||
.filter(|i| i.is_doc_comment())
|
||||
.filter(|i| i.is_doc_comment().is_some())
|
||||
.fold(item.span.shrink_to_lo(), |span, attr| span.to(attr.span()));
|
||||
let (Some(file), _, _, end_line, _) = sm.span_to_location_info(span) else {
|
||||
return;
|
||||
|
||||
@@ -475,7 +475,7 @@ fn block_has_safety_comment(cx: &LateContext<'_>, span: Span) -> bool {
|
||||
|
||||
fn include_attrs_in_span(cx: &LateContext<'_>, hir_id: HirId, span: Span) -> Span {
|
||||
span.to(cx.tcx.hir_attrs(hir_id).iter().fold(span, |acc, attr| {
|
||||
if attr.is_doc_comment() {
|
||||
if attr.is_doc_comment().is_some() {
|
||||
return acc;
|
||||
}
|
||||
acc.to(attr.span())
|
||||
|
||||
Reference in New Issue
Block a user