From 0a6ce30161fddfd5148507576b761b5e4a63ba99 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Fri, 24 Jun 2016 08:19:22 -0400 Subject: [PATCH] Use `Option::expect` instead of `unwrap_or_else` with `panic!`. --- src/libstd/thread/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 1f78b32bcf38e..d83d45518e404 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -482,9 +482,9 @@ pub struct Thread { impl Thread { // Used only internally to construct a thread object without spawning fn new(name: Option) -> Thread { - let cname = name.map(|n| CString::new(n).unwrap_or_else(|_| { - panic!("thread name may not contain interior null bytes") - })); + let cname = name.map(|n| { + CString::new(n).expect("thread name may not contain interior null bytes") + }); Thread { inner: Arc::new(Inner { name: cname,