diff options
| author | bors <bors@rust-lang.org> | 2019-02-03 18:40:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-02-03 18:40:23 +0000 |
| commit | 4f4f4a40b6c7bcb6fa07ee6575e8a9759ba08922 (patch) | |
| tree | 28a3d197b75da9125cc8f6de8d912f75c56e7e48 /src/liballoc/borrow.rs | |
| parent | e858c2637fa5bac40ac450628b30c56c2b4327b4 (diff) | |
| parent | 2396780cdaedf097dd6a8f3927749bcaf5b1238b (diff) | |
Auto merge of #58081 - Centril:liballoc-2018, r=oli-obk
Transition liballoc to Rust 2018 This transitions liballoc to Rust 2018 edition and applies relevant idiom lints. I also did a small bit of drive-by cleanup along the way. r? @oli-obk I started with liballoc since it seemed easiest. In particular, adding `edition = "2018"` to libcore gave me way too many errors due to stdsimd. Ideally we should be able to continue this crate-by-crate until all crates use 2018.
Diffstat (limited to 'src/liballoc/borrow.rs')
| -rw-r--r-- | src/liballoc/borrow.rs | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/liballoc/borrow.rs b/src/liballoc/borrow.rs index b47337e44b2..270f48e8083 100644 --- a/src/liballoc/borrow.rs +++ b/src/liballoc/borrow.rs @@ -6,14 +6,14 @@ use core::cmp::Ordering; use core::hash::{Hash, Hasher}; use core::ops::{Add, AddAssign, Deref}; -use fmt; -use string::String; - -use self::Cow::*; - #[stable(feature = "rust1", since = "1.0.0")] pub use core::borrow::{Borrow, BorrowMut}; +use crate::fmt; +use crate::string::String; + +use Cow::*; + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B> where B: ToOwned, @@ -182,9 +182,7 @@ pub enum Cow<'a, B: ?Sized + 'a> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized> Clone for Cow<'a, B> - where B: ToOwned -{ +impl<'a, B: ?Sized + ToOwned> Clone for Cow<'a, B> { fn clone(&self) -> Cow<'a, B> { match *self { Borrowed(b) => Borrowed(b), @@ -207,9 +205,7 @@ impl<'a, B: ?Sized> Clone for Cow<'a, B> } } -impl<'a, B: ?Sized> Cow<'a, B> - where B: ToOwned -{ +impl<B: ?Sized + ToOwned> Cow<'_, B> { /// Acquires a mutable reference to the owned form of the data. /// /// Clones the data if it is not already owned. @@ -285,9 +281,7 @@ impl<'a, B: ?Sized> Cow<'a, B> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized> Deref for Cow<'a, B> - where B: ToOwned -{ +impl<B: ?Sized + ToOwned> Deref for Cow<'_, B> { type Target = B; fn deref(&self) -> &B { @@ -299,7 +293,7 @@ impl<'a, B: ?Sized> Deref for Cow<'a, B> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized> Eq for Cow<'a, B> where B: Eq + ToOwned {} +impl<B: ?Sized> Eq for Cow<'_, B> where B: Eq + ToOwned {} #[stable(feature = "rust1", since = "1.0.0")] impl<'a, B: ?Sized> Ord for Cow<'a, B> @@ -333,11 +327,11 @@ impl<'a, B: ?Sized> PartialOrd for Cow<'a, B> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized> fmt::Debug for Cow<'a, B> +impl<B: ?Sized> fmt::Debug for Cow<'_, B> where B: fmt::Debug + ToOwned, <B as ToOwned>::Owned: fmt::Debug { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { Borrowed(ref b) => fmt::Debug::fmt(b, f), Owned(ref o) => fmt::Debug::fmt(o, f), @@ -346,11 +340,11 @@ impl<'a, B: ?Sized> fmt::Debug for Cow<'a, B> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized> fmt::Display for Cow<'a, B> +impl<B: ?Sized> fmt::Display for Cow<'_, B> where B: fmt::Display + ToOwned, <B as ToOwned>::Owned: fmt::Display { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { Borrowed(ref b) => fmt::Display::fmt(b, f), Owned(ref o) => fmt::Display::fmt(o, f), @@ -380,7 +374,7 @@ impl<'a, B: ?Sized> Hash for Cow<'a, B> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized + ToOwned> AsRef<T> for Cow<'a, T> { +impl<T: ?Sized + ToOwned> AsRef<T> for Cow<'_, T> { fn as_ref(&self) -> &T { self } |
