about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-02-02 10:34:36 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2019-02-02 10:34:36 +0100
commitf09f62f62c401a42bf338a23f8721c7f5a28a800 (patch)
treebf6faa1d899e58ff4435736ac371520dbd79786e /src/liballoc
parent7693e3e6662c2ae8aa24d69434161f501d855420 (diff)
downloadrust-f09f62f62c401a42bf338a23f8721c7f5a28a800.tar.gz
rust-f09f62f62c401a42bf338a23f8721c7f5a28a800.zip
liballoc: adjust abolute imports + more import fixes.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/lib.rs2
-rw-r--r--src/liballoc/raw_vec.rs2
-rw-r--r--src/liballoc/rc.rs3
-rw-r--r--src/liballoc/slice.rs4
-rw-r--r--src/liballoc/string.rs2
-rw-r--r--src/liballoc/sync.rs3
-rw-r--r--src/liballoc/tests/btree/map.rs2
-rw-r--r--src/liballoc/tests/str.rs4
-rw-r--r--src/liballoc/tests/string.rs4
-rw-r--r--src/liballoc/tests/vec.rs2
-rw-r--r--src/liballoc/vec.rs12
11 files changed, 15 insertions, 25 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index 5165a7ca5a8..5d69b100547 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -165,5 +165,5 @@ pub mod vec;
 
 #[cfg(not(test))]
 mod std {
-    pub use core::ops;      // RangeFull
+    pub use core::ops; // RangeFull
 }
diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs
index 92d482b1f05..016185791ed 100644
--- a/src/liballoc/raw_vec.rs
+++ b/src/liballoc/raw_vec.rs
@@ -736,7 +736,7 @@ unsafe impl<#[may_dangle] T, A: Alloc> Drop for RawVec<T, A> {
 
 #[inline]
 fn alloc_guard(alloc_size: usize) -> Result<(), CollectionAllocErr> {
-    if mem::size_of::<usize>() < 8 && alloc_size > ::core::isize::MAX as usize {
+    if mem::size_of::<usize>() < 8 && alloc_size > core::isize::MAX as usize {
         Err(CapacityOverflow)
     } else {
         Ok(())
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index 720ac4b630a..c24e2163839 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -244,6 +244,7 @@ use core::{
     ops::{Deref, Receiver, CoerceUnsized, DispatchFromDyn},
     pin::Pin,
     ptr::{self, NonNull},
+    slice::from_raw_parts_mut,
     convert::From,
     usize,
 };
@@ -768,8 +769,6 @@ impl<T: Clone> RcFromSlice<T> for Rc<[T]> {
 
         impl<T> Drop for Guard<T> {
             fn drop(&mut self) {
-                use core::slice::from_raw_parts_mut;
-
                 unsafe {
                     let slice = from_raw_parts_mut(self.elems, self.n_elems);
                     ptr::drop_in_place(slice);
diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs
index 1cee3aa415b..771d8f5d347 100644
--- a/src/liballoc/slice.rs
+++ b/src/liballoc/slice.rs
@@ -141,13 +141,11 @@ pub use self::hack::to_vec;
 // `test_permutations` test
 mod hack {
     use core::mem;
-    use crate::boxed::Box;
+    use crate::{boxed::Box, vec::Vec};
 
     #[cfg(test)]
     use crate::string::ToString;
 
-    use crate::vec::Vec;
-
     pub fn into_vec<T>(mut b: Box<[T]>) -> Vec<T> {
         unsafe {
             let xs = Vec::from_raw_parts(b.as_mut_ptr(), b.len(), b.len());
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index e9da10b3597..95f6b28a168 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -2165,7 +2165,7 @@ pub trait ToString {
 impl<T: fmt::Display + ?Sized> ToString for T {
     #[inline]
     default fn to_string(&self) -> String {
-        use core::fmt::Write;
+        use fmt::Write;
         let mut buf = String::new();
         buf.write_fmt(format_args!("{}", self))
            .expect("a Display implementation returned an error unexpectedly");
diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs
index 2a4b3113bfe..5e7a26132cb 100644
--- a/src/liballoc/sync.rs
+++ b/src/liballoc/sync.rs
@@ -24,6 +24,7 @@ use core::{
     hash::{Hash, Hasher},
     isize, usize,
     convert::From,
+    slice::from_raw_parts_mut,
 };
 
 use crate::{
@@ -677,8 +678,6 @@ impl<T: Clone> ArcFromSlice<T> for Arc<[T]> {
 
         impl<T> Drop for Guard<T> {
             fn drop(&mut self) {
-                use core::slice::from_raw_parts_mut;
-
                 unsafe {
                     let slice = from_raw_parts_mut(self.elems, self.n_elems);
                     ptr::drop_in_place(slice);
diff --git a/src/liballoc/tests/btree/map.rs b/src/liballoc/tests/btree/map.rs
index 33f65980784..6859b0138b5 100644
--- a/src/liballoc/tests/btree/map.rs
+++ b/src/liballoc/tests/btree/map.rs
@@ -200,7 +200,7 @@ fn test_range_inclusive() {
 
 #[test]
 fn test_range_inclusive_max_value() {
-    let max = ::std::usize::MAX;
+    let max = std::usize::MAX;
     let map: BTreeMap<_, _> = vec![(max, 0)].into_iter().collect();
 
     assert_eq!(map.range(max..=max).collect::<Vec<_>>(), &[(&max, &0)]);
diff --git a/src/liballoc/tests/str.rs b/src/liballoc/tests/str.rs
index 583e616bf6d..28e021c741e 100644
--- a/src/liballoc/tests/str.rs
+++ b/src/liballoc/tests/str.rs
@@ -1070,7 +1070,7 @@ fn test_rev_iterator() {
 #[test]
 fn test_chars_decoding() {
     let mut bytes = [0; 4];
-    for c in (0..0x110000).filter_map(::std::char::from_u32) {
+    for c in (0..0x110000).filter_map(std::char::from_u32) {
         let s = c.encode_utf8(&mut bytes);
         if Some(c) != s.chars().next() {
             panic!("character {:x}={} does not decode correctly", c as u32, c);
@@ -1081,7 +1081,7 @@ fn test_chars_decoding() {
 #[test]
 fn test_chars_rev_decoding() {
     let mut bytes = [0; 4];
-    for c in (0..0x110000).filter_map(::std::char::from_u32) {
+    for c in (0..0x110000).filter_map(std::char::from_u32) {
         let s = c.encode_utf8(&mut bytes);
         if Some(c) != s.chars().rev().next() {
             panic!("character {:x}={} does not decode correctly", c as u32, c);
diff --git a/src/liballoc/tests/string.rs b/src/liballoc/tests/string.rs
index 9e4ffb5be9d..14f70fdf303 100644
--- a/src/liballoc/tests/string.rs
+++ b/src/liballoc/tests/string.rs
@@ -23,7 +23,7 @@ impl<'a> IntoCow<'a, str> for &'a str {
 
 #[test]
 fn test_from_str() {
-    let owned: Option<::std::string::String> = "string".parse().ok();
+    let owned: Option<std::string::String> = "string".parse().ok();
     assert_eq!(owned.as_ref().map(|s| &**s), Some("string"));
 }
 
@@ -124,7 +124,7 @@ fn test_from_utf16() {
         let s_as_utf16 = s.encode_utf16().collect::<Vec<u16>>();
         let u_as_string = String::from_utf16(&u).unwrap();
 
-        assert!(::core::char::decode_utf16(u.iter().cloned()).all(|r| r.is_ok()));
+        assert!(core::char::decode_utf16(u.iter().cloned()).all(|r| r.is_ok()));
         assert_eq!(s_as_utf16, u);
 
         assert_eq!(u_as_string, s);
diff --git a/src/liballoc/tests/vec.rs b/src/liballoc/tests/vec.rs
index 473d41d483e..b65c68d51a5 100644
--- a/src/liballoc/tests/vec.rs
+++ b/src/liballoc/tests/vec.rs
@@ -640,7 +640,7 @@ fn test_splice_unbounded() {
 fn test_splice_forget() {
     let mut v = vec![1, 2, 3, 4, 5];
     let a = [10, 11, 12];
-    ::std::mem::forget(v.splice(2..4, a.iter().cloned()));
+    std::mem::forget(v.splice(2..4, a.iter().cloned()));
     assert_eq!(v, &[1, 2]);
 }
 
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 69fcd87dae6..2ef1497ade7 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -70,7 +70,7 @@ use core::{
         Index, IndexMut, RangeBounds,
     },
     ptr::{self, NonNull},
-    slice,
+    slice::{self, SliceIndex},
 };
 
 use crate::{
@@ -1672,10 +1672,7 @@ impl<T: Hash> Hash for Vec<T> {
     message="vector indices are of type `usize` or ranges of `usize`",
     label="vector indices are of type `usize` or ranges of `usize`",
 )]
-impl<T, I> Index<I> for Vec<T>
-where
-    I: ::core::slice::SliceIndex<[T]>,
-{
+impl<T, I: SliceIndex<[T]>> Index<I> for Vec<T> {
     type Output = I::Output;
 
     #[inline]
@@ -1689,10 +1686,7 @@ where
     message="vector indices are of type `usize` or ranges of `usize`",
     label="vector indices are of type `usize` or ranges of `usize`",
 )]
-impl<T, I> IndexMut<I> for Vec<T>
-where
-    I: ::core::slice::SliceIndex<[T]>,
-{
+impl<T, I: SliceIndex<[T]>> IndexMut<I> for Vec<T> {
     #[inline]
     fn index_mut(&mut self, index: I) -> &mut Self::Output {
         IndexMut::index_mut(&mut **self, index)