diff options
| author | Michael Howell <michael@notriddle.com> | 2024-11-27 13:47:15 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2024-11-27 13:51:31 -0700 |
| commit | 8dd45f18b3e443749f2e607eb0dfb7edf181a92d (patch) | |
| tree | 00104616ac6df1f6e333e1965b1ef04f3344ac5d | |
| parent | 44feca7f3fcefb7dc014001a0f1d6fb1135e51f8 (diff) | |
| download | rust-8dd45f18b3e443749f2e607eb0dfb7edf181a92d.tar.gz rust-8dd45f18b3e443749f2e607eb0dfb7edf181a92d.zip | |
doc_nested_refdefs: apply suggestions
Co-Authored-By: Jason Newcomb <jsnewcomb@pm.me>
| -rw-r--r-- | clippy_lints/src/doc/mod.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/clippy_lints/src/doc/mod.rs b/clippy_lints/src/doc/mod.rs index f3a275db752..2b06e34a61c 100644 --- a/clippy_lints/src/doc/mod.rs +++ b/clippy_lints/src/doc/mod.rs @@ -1120,23 +1120,23 @@ impl<'tcx> Visitor<'tcx> for FindPanicUnwrap<'_, 'tcx> { } } -#[allow(clippy::range_plus_one)] // inclusive ranges aren't the same type +#[expect(clippy::range_plus_one)] // inclusive ranges aren't the same type fn looks_like_refdef(doc: &str, range: Range<usize>) -> Option<Range<usize>> { let offset = range.start; let mut iterator = doc.as_bytes()[range].iter().copied().enumerate(); let mut start = None; while let Some((i, byte)) = iterator.next() { - if byte == b'\\' { - iterator.next(); - continue; - } - if byte == b'[' { - start = Some(i + offset); - } - if let Some(start) = start - && byte == b']' - { - return Some(start..i + offset + 1); + match byte { + b'\\' => { + iterator.next(); + }, + b'[' => { + start = Some(i + offset); + }, + b']' if let Some(start) = start => { + return Some(start..i + offset + 1); + }, + _ => {}, } } None |
