Skip to content

Commit 8dd45f1

Browse files
notriddleJarcho
andcommitted
doc_nested_refdefs: apply suggestions
Co-Authored-By: Jason Newcomb <[email protected]>
1 parent 44feca7 commit 8dd45f1

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

clippy_lints/src/doc/mod.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -1120,23 +1120,23 @@ impl<'tcx> Visitor<'tcx> for FindPanicUnwrap<'_, 'tcx> {
11201120
}
11211121
}
11221122

1123-
#[allow(clippy::range_plus_one)] // inclusive ranges aren't the same type
1123+
#[expect(clippy::range_plus_one)] // inclusive ranges aren't the same type
11241124
fn looks_like_refdef(doc: &str, range: Range<usize>) -> Option<Range<usize>> {
11251125
let offset = range.start;
11261126
let mut iterator = doc.as_bytes()[range].iter().copied().enumerate();
11271127
let mut start = None;
11281128
while let Some((i, byte)) = iterator.next() {
1129-
if byte == b'\\' {
1130-
iterator.next();
1131-
continue;
1132-
}
1133-
if byte == b'[' {
1134-
start = Some(i + offset);
1135-
}
1136-
if let Some(start) = start
1137-
&& byte == b']'
1138-
{
1139-
return Some(start..i + offset + 1);
1129+
match byte {
1130+
b'\\' => {
1131+
iterator.next();
1132+
},
1133+
b'[' => {
1134+
start = Some(i + offset);
1135+
},
1136+
b']' if let Some(start) = start => {
1137+
return Some(start..i + offset + 1);
1138+
},
1139+
_ => {},
11401140
}
11411141
}
11421142
None

0 commit comments

Comments
 (0)