Skip to content

Commit 4bf8b57

Browse files
committed
remove "get_with" method
1 parent 20b50f5 commit 4bf8b57

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

src/libcore/cell.rs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ impl<T: ?Sized> Cell<T> {
510510
/// use std::cell::Cell;
511511
/// let slice: &mut [i32] = &mut [1,2,3];
512512
/// let cell_slice: &Cell<[i32]> = Cell::from_mut(slice);
513-
///
514-
/// assert_eq!(cell_slice.get_with(|v|v.len()), 3)
513+
/// let slice_cell : &[Cell<i32>] = &cell_slice[..];
514+
/// assert_eq!(slice_cell.len(), 3)
515515
/// ```
516516
#[inline]
517517
#[unstable(feature = "as_cell", issue="43038")]
@@ -520,28 +520,6 @@ impl<T: ?Sized> Cell<T> {
520520
&*(t as *mut T as *const Cell<T>)
521521
}
522522
}
523-
524-
/// Returns a value by applying a function on contained value
525-
///
526-
/// # Examples
527-
///
528-
/// ```
529-
/// #![feature(as_cell)]
530-
/// use std::cell::Cell;
531-
/// let c : Cell<Vec<i32>> = Cell::new(vec![1,2,3]);
532-
/// let sum : i32 = c.get_with(|v|v.iter().sum());
533-
/// assert_eq!(sum, 6_i32);
534-
/// ```
535-
#[inline]
536-
#[unstable(feature = "as_cell", issue="43038")]
537-
pub fn get_with<U, F>(&self, f: F) -> U
538-
where
539-
F: Fn(&T) -> U, U: 'static
540-
{
541-
unsafe {
542-
f(&*self.value.get())
543-
}
544-
}
545523
}
546524

547525
impl<T: Default> Cell<T> {

src/test/run-pass/rfc-1789-as-cell/from-mut.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ use std::cell::Cell;
1515
fn main() {
1616
let slice: &mut [i32] = &mut [1,2,3];
1717
let cell_slice: &Cell<[i32]> = Cell::from_mut(slice);
18-
assert_eq!(cell_slice.get_with(|v|v.len()), 3);
19-
2018
let sub_slice : &[Cell<i32>] = &cell_slice[1..];
2119
assert_eq!(sub_slice.len(), 2);
2220
}

0 commit comments

Comments
 (0)