Skip to content

Commit 35004b4

Browse files
authored
Auto merge of #34452 - frewsxcv:unwrap-or, r=alexcrichton
Use `Option::expect` instead of `unwrap_or_else` with `panic!`. None
2 parents c128e9b + 0a6ce30 commit 35004b4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libstd/thread/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,9 @@ pub struct Thread {
482482
impl Thread {
483483
// Used only internally to construct a thread object without spawning
484484
fn new(name: Option<String>) -> Thread {
485-
let cname = name.map(|n| CString::new(n).unwrap_or_else(|_| {
486-
panic!("thread name may not contain interior null bytes")
487-
}));
485+
let cname = name.map(|n| {
486+
CString::new(n).expect("thread name may not contain interior null bytes")
487+
});
488488
Thread {
489489
inner: Arc::new(Inner {
490490
name: cname,

0 commit comments

Comments
 (0)