Skip to content

Commit 9d48ae2

Browse files
committed
fmt
1 parent 135c50f commit 9d48ae2

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

compiler/rustc_resolve/src/rustdoc.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,7 @@ pub fn source_span_for_markdown_range(
537537
fragments: &[DocFragment],
538538
) -> Option<Span> {
539539
let map = tcx.sess.source_map();
540-
source_span_for_markdown_range_inner(
541-
map, markdown, md_range, fragments)
540+
source_span_for_markdown_range_inner(map, markdown, md_range, fragments)
542541
}
543542

544543
// inner function used for unit testing
@@ -587,8 +586,10 @@ pub fn source_span_for_markdown_range_inner(
587586
// multiple matches in this fragment, there is ambiguity.
588587
// the snippet cannot be zero-sized, because it matches
589588
// the pattern, which is checked to not be zero sized.
590-
if match_data.is_none() &&
591-
!snippet.as_bytes()[match_start + 1..].windows(pat.len()).any(|s| s == pat.as_bytes())
589+
if match_data.is_none()
590+
&& !snippet.as_bytes()[match_start + 1..]
591+
.windows(pat.len())
592+
.any(|s| s == pat.as_bytes())
592593
{
593594
match_data = Some((i, match_start));
594595
} else {

compiler/rustc_resolve/src/rustdoc/tests.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
use std::path::PathBuf;
22

3-
use rustc_span::{source_map::{FilePathMapping, SourceMap}, BytePos, Span, symbol::sym};
3+
use rustc_span::source_map::{FilePathMapping, SourceMap};
4+
use rustc_span::symbol::sym;
5+
use rustc_span::{BytePos, Span};
46

5-
use super::{source_span_for_markdown_range_inner, DocFragment, DocFragmentKind};
7+
use super::{DocFragment, DocFragmentKind, source_span_for_markdown_range_inner};
68

79
#[test]
810
fn single_backtick() {
@@ -12,14 +14,15 @@ fn single_backtick() {
1214
&sm,
1315
"`",
1416
&(0..1),
15-
&[DocFragment{
17+
&[DocFragment {
1618
span: Span::with_root_ctxt(BytePos(8), BytePos(11)),
1719
item_id: None,
1820
kind: DocFragmentKind::RawDoc,
1921
doc: sym::empty, // unused placeholder
2022
indent: 0,
2123
}],
22-
).unwrap();
24+
)
25+
.unwrap();
2326
assert_eq!(span.lo(), BytePos(9));
2427
assert_eq!(span.hi(), BytePos(10));
2528
}
@@ -33,14 +36,15 @@ fn utf8() {
3336
&sm,
3437
"⚠",
3538
&(0..3),
36-
&[DocFragment{
39+
&[DocFragment {
3740
span: Span::with_root_ctxt(BytePos(8), BytePos(14)),
3841
item_id: None,
3942
kind: DocFragmentKind::RawDoc,
4043
doc: sym::empty, // unused placeholder
4144
indent: 0,
4245
}],
43-
).unwrap();
46+
)
47+
.unwrap();
4448
assert_eq!(span.lo(), BytePos(9));
4549
assert_eq!(span.hi(), BytePos(12));
4650
}

0 commit comments

Comments
 (0)