From 4ffd9f49c340c350080bfe6c1be9e3aaccd549d0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Dec 2014 07:49:45 -0800 Subject: Avoid .take().unwrap() with FnOnce closures --- src/libstd/thread_local/mod.rs | 5 ++--- src/libstd/thread_local/scoped.rs | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/libstd/thread_local') diff --git a/src/libstd/thread_local/mod.rs b/src/libstd/thread_local/mod.rs index e2cedae1be6..4c052a4ce09 100644 --- a/src/libstd/thread_local/mod.rs +++ b/src/libstd/thread_local/mod.rs @@ -217,9 +217,8 @@ impl Key { /// This function will `panic!()` if the key currently has its /// destructor running, and it **may** panic if the destructor has /// previously been run for this thread. - pub fn with(&'static self, f: F) -> R where - F: FnOnce(&T) -> R, - { + pub fn with(&'static self, f: F) -> R + where F: FnOnce(&T) -> R { let slot = (self.inner)(); unsafe { let slot = slot.get().expect("cannot access a TLS value during or \ diff --git a/src/libstd/thread_local/scoped.rs b/src/libstd/thread_local/scoped.rs index 7762d225b9a..96f09190c2f 100644 --- a/src/libstd/thread_local/scoped.rs +++ b/src/libstd/thread_local/scoped.rs @@ -262,4 +262,3 @@ mod tests { }); } } - -- cgit 1.4.1-3-g733a5