Skip to content

Commit bd9ff84

Browse files
committed
Cleanup liballoc use statements
Some modules were still using the deprecated `allocator` module, use the `alloc` module instead. Some modules were using `super` while it's not needed. Some modules were more or less ordering them, and other not, so the latter have been modified to match the others.
1 parent 9c2bfcb commit bd9ff84

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

src/liballoc/boxed.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@
5555
5656
#![stable(feature = "rust1", since = "1.0.0")]
5757

58-
use raw_vec::RawVec;
59-
6058
use core::any::Any;
6159
use core::borrow;
6260
use core::cmp::Ordering;
@@ -68,6 +66,8 @@ use core::mem::{self, Pin};
6866
use core::ops::{CoerceUnsized, Deref, DerefMut, Generator, GeneratorState};
6967
use core::ptr::{self, NonNull, Unique};
7068
use core::convert::From;
69+
70+
use raw_vec::RawVec;
7171
use str::from_boxed_utf8_unchecked;
7272

7373
/// A pointer type for heap allocation.

src/liballoc/raw_vec.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use alloc::{Alloc, Layout, Global};
1211
use core::cmp;
1312
use core::mem;
1413
use core::ops::Drop;
1514
use core::ptr::{self, NonNull, Unique};
1615
use core::slice;
17-
use super::boxed::Box;
18-
use super::allocator::CollectionAllocErr;
19-
use super::allocator::CollectionAllocErr::*;
16+
17+
use alloc::{Alloc, Layout, Global};
18+
use alloc::CollectionAllocErr;
19+
use alloc::CollectionAllocErr::*;
20+
use boxed::Box;
2021

2122
/// A low-level utility for more ergonomically allocating, reallocating, and deallocating
2223
/// a buffer of memory on the heap without having to worry about all the corner cases

src/liballoc/str.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ use core::mem;
4646
use core::ptr;
4747
use core::iter::FusedIterator;
4848

49-
use vec_deque::VecDeque;
5049
use borrow::{Borrow, ToOwned};
50+
use boxed::Box;
51+
use slice::{SliceConcatExt, SliceIndex};
5152
use string::String;
5253
use vec::Vec;
53-
use slice::{SliceConcatExt, SliceIndex};
54-
use boxed::Box;
54+
use vec_deque::VecDeque;
5555

5656
#[stable(feature = "rust1", since = "1.0.0")]
5757
pub use core::str::{FromStr, Utf8Error};

src/liballoc/string.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ use core::ptr;
6666
use core::str::pattern::Pattern;
6767
use core::str::lossy;
6868

69+
use alloc::CollectionAllocErr;
6970
use borrow::{Cow, ToOwned};
71+
use boxed::Box;
7072
use str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars};
7173
use vec::Vec;
72-
use boxed::Box;
73-
use super::allocator::CollectionAllocErr;
7474

7575
/// A UTF-8 encoded, growable string.
7676
///

src/liballoc/vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ use core::ptr;
8282
use core::ptr::NonNull;
8383
use core::slice;
8484

85+
use alloc::CollectionAllocErr;
8586
use borrow::ToOwned;
8687
use borrow::Cow;
8788
use boxed::Box;
8889
use raw_vec::RawVec;
89-
use super::allocator::CollectionAllocErr;
9090

9191
/// A contiguous growable array type, written `Vec<T>` but pronounced 'vector'.
9292
///

src/liballoc/vec_deque.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ use core::slice;
3030
use core::hash::{Hash, Hasher};
3131
use core::cmp;
3232

33+
use alloc::CollectionAllocErr;
3334
use raw_vec::RawVec;
34-
35-
use super::allocator::CollectionAllocErr;
36-
use super::vec::Vec;
35+
use vec::Vec;
3736

3837
const INITIAL_CAPACITY: usize = 7; // 2^3 - 1
3938
const MINIMUM_CAPACITY: usize = 1; // 2 - 1

0 commit comments

Comments
 (0)