diff options
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/cell.rs | 2 | ||||
| -rw-r--r-- | src/libcore/fmt/mod.rs | 10 | ||||
| -rw-r--r-- | src/libcore/iter/iterator.rs | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index efba8798309..c3f862e7c54 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -394,6 +394,7 @@ pub struct RefCell<T: ?Sized> { #[derive(Copy, Clone, PartialEq, Eq, Debug)] #[unstable(feature = "borrow_state", issue = "27733")] #[rustc_deprecated(since = "1.15.0", reason = "use `try_borrow` instead")] +#[allow(deprecated)] pub enum BorrowState { /// The cell is currently being read, there is at least one active `borrow`. Reading, @@ -513,6 +514,7 @@ impl<T: ?Sized> RefCell<T> { /// ``` #[unstable(feature = "borrow_state", issue = "27733")] #[rustc_deprecated(since = "1.15.0", reason = "use `try_borrow` instead")] + #[allow(deprecated)] #[inline] pub fn borrow_state(&self) -> BorrowState { match self.borrow.get() { diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 9167264ba9d..2ba7d6e8bd1 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -12,7 +12,7 @@ #![stable(feature = "rust1", since = "1.0.0")] -use cell::{UnsafeCell, Cell, RefCell, Ref, RefMut, BorrowState}; +use cell::{UnsafeCell, Cell, RefCell, Ref, RefMut}; use marker::PhantomData; use mem; use num::flt2dec; @@ -1634,13 +1634,13 @@ impl<T: Copy + Debug> Debug for Cell<T> { #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized + Debug> Debug for RefCell<T> { fn fmt(&self, f: &mut Formatter) -> Result { - match self.borrow_state() { - BorrowState::Unused | BorrowState::Reading => { + match self.try_borrow() { + Ok(borrow) => { f.debug_struct("RefCell") - .field("value", &self.borrow()) + .field("value", &borrow) .finish() } - BorrowState::Writing => { + Err(_) => { f.debug_struct("RefCell") .field("value", &"<borrowed>") .finish() diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs index cdc804b9ad6..ec590d2bd06 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/iterator.rs @@ -1696,7 +1696,6 @@ pub trait Iterator { /// # Examples /// /// ``` - /// #![feature(iter_max_by)] /// let a = [-3_i32, 0, 1, 5, -10]; /// assert_eq!(*a.iter().max_by(|x, y| x.cmp(y)).unwrap(), 5); /// ``` @@ -1746,7 +1745,6 @@ pub trait Iterator { /// # Examples /// /// ``` - /// #![feature(iter_min_by)] /// let a = [-3_i32, 0, 1, 5, -10]; /// assert_eq!(*a.iter().min_by(|x, y| x.cmp(y)).unwrap(), -10); /// ``` |
