diff options
| author | bors <bors@rust-lang.org> | 2019-04-22 07:28:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-04-22 07:28:20 +0000 |
| commit | a850a426491e14186af2250549bf41256b5938d2 (patch) | |
| tree | a701948928cb8ab476f2e44bb331925b3530d1d1 /src/liballoc | |
| parent | 8f06188991e8e7c764f0775a35432d39e2596c9a (diff) | |
| parent | 8e5555909c1c425241ff3733efaa50986a124623 (diff) | |
| download | rust-a850a426491e14186af2250549bf41256b5938d2.tar.gz rust-a850a426491e14186af2250549bf41256b5938d2.zip | |
Auto merge of #60133 - phansch:deny_rust_2018_idioms, r=Centril
Deny rust_2018_idioms globally cc https://github.com/rust-lang/rust/issues/58099#issuecomment-484921194
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/tests/cow_str.rs | 24 | ||||
| -rw-r--r-- | src/liballoc/tests/lib.rs | 1 | ||||
| -rw-r--r-- | src/liballoc/tests/string.rs | 4 |
3 files changed, 15 insertions, 14 deletions
diff --git a/src/liballoc/tests/cow_str.rs b/src/liballoc/tests/cow_str.rs index eb6adb159b0..6f357eda9b8 100644 --- a/src/liballoc/tests/cow_str.rs +++ b/src/liballoc/tests/cow_str.rs @@ -7,9 +7,9 @@ fn check_cow_add_cow() { let borrowed2 = Cow::Borrowed("World!"); let borrow_empty = Cow::Borrowed(""); - let owned1: Cow<str> = Cow::Owned(String::from("Hi, ")); - let owned2: Cow<str> = Cow::Owned(String::from("Rustaceans!")); - let owned_empty: Cow<str> = Cow::Owned(String::new()); + let owned1: Cow<'_, str> = Cow::Owned(String::from("Hi, ")); + let owned2: Cow<'_, str> = Cow::Owned(String::from("Rustaceans!")); + let owned_empty: Cow<'_, str> = Cow::Owned(String::new()); assert_eq!("Hello, World!", borrowed1.clone() + borrowed2.clone()); assert_eq!("Hello, Rustaceans!", borrowed1.clone() + owned2.clone()); @@ -36,8 +36,8 @@ fn check_cow_add_str() { let borrowed = Cow::Borrowed("Hello, "); let borrow_empty = Cow::Borrowed(""); - let owned: Cow<str> = Cow::Owned(String::from("Hi, ")); - let owned_empty: Cow<str> = Cow::Owned(String::new()); + let owned: Cow<'_, str> = Cow::Owned(String::from("Hi, ")); + let owned_empty: Cow<'_, str> = Cow::Owned(String::new()); assert_eq!("Hello, World!", borrowed.clone() + "World!"); @@ -60,9 +60,9 @@ fn check_cow_add_assign_cow() { let borrowed2 = Cow::Borrowed("World!"); let borrow_empty = Cow::Borrowed(""); - let mut owned1: Cow<str> = Cow::Owned(String::from("Hi, ")); - let owned2: Cow<str> = Cow::Owned(String::from("Rustaceans!")); - let owned_empty: Cow<str> = Cow::Owned(String::new()); + let mut owned1: Cow<'_, str> = Cow::Owned(String::from("Hi, ")); + let owned2: Cow<'_, str> = Cow::Owned(String::from("Rustaceans!")); + let owned_empty: Cow<'_, str> = Cow::Owned(String::new()); let mut s = borrowed1.clone(); s += borrow_empty.clone(); @@ -101,8 +101,8 @@ fn check_cow_add_assign_str() { let mut borrowed = Cow::Borrowed("Hello, "); let borrow_empty = Cow::Borrowed(""); - let mut owned: Cow<str> = Cow::Owned(String::from("Hi, ")); - let owned_empty: Cow<str> = Cow::Owned(String::new()); + let mut owned: Cow<'_, str> = Cow::Owned(String::from("Hi, ")); + let owned_empty: Cow<'_, str> = Cow::Owned(String::new()); let mut s = borrowed.clone(); s += ""; @@ -132,10 +132,10 @@ fn check_cow_add_assign_str() { #[test] fn check_cow_clone_from() { - let mut c1: Cow<str> = Cow::Owned(String::with_capacity(25)); + let mut c1: Cow<'_, str> = Cow::Owned(String::with_capacity(25)); let s: String = "hi".to_string(); assert!(s.capacity() < 25); - let c2: Cow<str> = Cow::Owned(s); + let c2: Cow<'_, str> = Cow::Owned(s); c1.clone_from(&c2); assert!(c1.into_owned().capacity() >= 25); } diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs index 90921b6af9f..b736750c576 100644 --- a/src/liballoc/tests/lib.rs +++ b/src/liballoc/tests/lib.rs @@ -7,6 +7,7 @@ #![feature(try_reserve)] #![feature(unboxed_closures)] #![feature(vecdeque_rotate)] +#![deny(rust_2018_idioms)] use std::hash::{Hash, Hasher}; use std::collections::hash_map::DefaultHasher; diff --git a/src/liballoc/tests/string.rs b/src/liballoc/tests/string.rs index 7e75b8c4f28..765210e5aa6 100644 --- a/src/liballoc/tests/string.rs +++ b/src/liballoc/tests/string.rs @@ -54,11 +54,11 @@ fn test_from_utf8() { #[test] fn test_from_utf8_lossy() { let xs = b"hello"; - let ys: Cow<str> = "hello".into_cow(); + let ys: Cow<'_, str> = "hello".into_cow(); assert_eq!(String::from_utf8_lossy(xs), ys); let xs = "ศไทย中华Việt Nam".as_bytes(); - let ys: Cow<str> = "ศไทย中华Việt Nam".into_cow(); + let ys: Cow<'_, str> = "ศไทย中华Việt Nam".into_cow(); assert_eq!(String::from_utf8_lossy(xs), ys); let xs = b"Hello\xC2 There\xFF Goodbye"; |
