Skip to content

Commit 14b446c

Browse files
authored
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`
2 parents e8fec08 + 5f0f7d8 commit 14b446c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clippy_lints/src/four_forward_slashes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<'tcx> LateLintPass<'tcx> for FourForwardSlashes {
4747
.tcx
4848
.hir_attrs(item.hir_id())
4949
.iter()
50-
.filter(|i| i.is_doc_comment())
50+
.filter(|i| i.is_doc_comment().is_some())
5151
.fold(item.span.shrink_to_lo(), |span, attr| span.to(attr.span()));
5252
let (Some(file), _, _, end_line, _) = sm.span_to_location_info(span) else {
5353
return;

clippy_lints/src/undocumented_unsafe_blocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ fn block_has_safety_comment(cx: &LateContext<'_>, span: Span) -> bool {
475475

476476
fn include_attrs_in_span(cx: &LateContext<'_>, hir_id: HirId, span: Span) -> Span {
477477
span.to(cx.tcx.hir_attrs(hir_id).iter().fold(span, |acc, attr| {
478-
if attr.is_doc_comment() {
478+
if attr.is_doc_comment().is_some() {
479479
return acc;
480480
}
481481
acc.to(attr.span())

0 commit comments

Comments
 (0)