Skip to content

Commit 73e13a5

Browse files
more let-chains!
1 parent 103f7b6 commit 73e13a5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/types.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,15 @@ impl<'a> BytesOrWideString<'a> {
6666
}
6767
}
6868

69-
if let BytesOrWideString::Bytes(b) = self {
70-
if let Ok(s) = str::from_utf8(b) {
71-
return PathBuf::from(s);
72-
}
69+
// cross-platform fallback is to pray we are dealing with utf-8
70+
if let BytesOrWideString::Bytes(b) = self
71+
&& let Ok(s) = str::from_utf8(b)
72+
{
73+
PathBuf::from(s);
74+
} else {
75+
// or die
76+
unreachable!()
7377
}
74-
unreachable!()
7578
}
7679
}
7780

0 commit comments

Comments
 (0)