1
Fork 0

libstd: Change all uses of &fn(A)->B over to |A|->B in libstd

This commit is contained in:
Patrick Walton 2013-11-18 21:15:42 -08:00
parent eef913b290
commit 1946265e1a
58 changed files with 270 additions and 236 deletions

View file

@ -71,12 +71,12 @@ impl<T> Cell<T> {
}
/// Calls a closure with a reference to the value.
pub fn with_ref<R>(&self, op: &fn(v: &T) -> R) -> R {
pub fn with_ref<R>(&self, op: |v: &T| -> R) -> R {
do self.with_mut_ref |ptr| { op(ptr) }
}
/// Calls a closure with a mutable reference to the value.
pub fn with_mut_ref<R>(&self, op: &fn(v: &mut T) -> R) -> R {
pub fn with_mut_ref<R>(&self, op: |v: &mut T| -> R) -> R {
let mut v = Some(self.take());
do (|| {
op(v.get_mut_ref())