about summary refs log tree commit diff
path: root/src/libstd/thread
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2016-06-24 08:19:22 -0400
committerCorey Farwell <coreyf@rwell.org>2016-06-24 08:19:22 -0400
commit0a6ce30161fddfd5148507576b761b5e4a63ba99 (patch)
tree34e8b5a53aa4d8a463c7605fdccfade3e2d37755 /src/libstd/thread
parent8c63d12dc3abc9ef16ca5ec3cf03f0dfbf09c3a5 (diff)
downloadrust-0a6ce30161fddfd5148507576b761b5e4a63ba99.tar.gz
rust-0a6ce30161fddfd5148507576b761b5e4a63ba99.zip
Use `Option::expect` instead of `unwrap_or_else` with `panic!`.
Diffstat (limited to 'src/libstd/thread')
-rw-r--r--src/libstd/thread/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 1f78b32bcf3..d83d45518e4 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<String>) -> 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,