Skip to content

Commit 0a6ce30

Browse files
committed
Use Option::expect instead of unwrap_or_else with panic!.
1 parent 8c63d12 commit 0a6ce30

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)