libstd: Change all uses of &fn(A)->B
over to |A|->B
in libstd
This commit is contained in:
parent
eef913b290
commit
1946265e1a
58 changed files with 270 additions and 236 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue