Skip to content

Commit ecdc8ab

Browse files
committed
Fix a clippy::single-match warning.
1 parent 8d6e19e commit ecdc8ab

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

mp4parse/src/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5431,14 +5431,13 @@ fn read_hdlr<T: Read>(src: &mut BMFFBox<T>, strictness: ParseStrictness) -> Resu
54315431

54325432
match std::str::from_utf8(src.read_into_try_vec()?.as_slice()) {
54335433
Ok(name) => {
5434-
match name.bytes().position(|b| b == b'\0') {
5435-
None => fail_with_status_if(
5434+
// `name` must be nul-terminated and any trailing bytes after the first nul ignored.
5435+
// See https://github.com/MPEGGroup/FileFormat/issues/35
5436+
if !name.bytes().any(|b| b == b'\0') {
5437+
fail_with_status_if(
54365438
strictness != ParseStrictness::Permissive,
54375439
Status::HdlrNameNoNul,
5438-
)?,
5439-
// `name` must be nul-terminated and any trailing bytes after the first nul ignored.
5440-
// See https://github.com/MPEGGroup/FileFormat/issues/35
5441-
Some(_) => (),
5440+
)?;
54425441
}
54435442
}
54445443
Err(_) => fail_with_status_if(

0 commit comments

Comments
 (0)