diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-12-10 07:49:45 -0800 |
|---|---|---|
| committer | Aaron Turon <aturon@mozilla.com> | 2014-12-18 23:31:52 -0800 |
| commit | 4ffd9f49c340c350080bfe6c1be9e3aaccd549d0 (patch) | |
| tree | 23aff13e71e93fa2c73cea94bf6128f920220dfe /src/libstd/thread_local | |
| parent | a7061d02e16d0821d3af2b753155fe44bab7725c (diff) | |
| download | rust-4ffd9f49c340c350080bfe6c1be9e3aaccd549d0.tar.gz rust-4ffd9f49c340c350080bfe6c1be9e3aaccd549d0.zip | |
Avoid .take().unwrap() with FnOnce closures
Diffstat (limited to 'src/libstd/thread_local')
| -rw-r--r-- | src/libstd/thread_local/mod.rs | 5 | ||||
| -rw-r--r-- | src/libstd/thread_local/scoped.rs | 1 |
2 files changed, 2 insertions, 4 deletions
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<T: 'static> Key<T> { /// 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<R, F>(&'static self, f: F) -> R where - F: FnOnce(&T) -> R, - { + pub fn with<F, R>(&'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 { }); } } - |
