Skip to content

Commit

Permalink
Cleanup liballoc use statements
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
glandium committed Apr 13, 2018
1 parent 9c2bfcb commit bd9ff84
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
#![stable(feature = "rust1", since = "1.0.0")]

use raw_vec::RawVec;

use core::any::Any;
use core::borrow;
use core::cmp::Ordering;
Expand All @@ -68,6 +66,8 @@ use core::mem::{self, Pin};
use core::ops::{CoerceUnsized, Deref, DerefMut, Generator, GeneratorState};
use core::ptr::{self, NonNull, Unique};
use core::convert::From;

use raw_vec::RawVec;
use str::from_boxed_utf8_unchecked;

/// A pointer type for heap allocation.
Expand Down
9 changes: 5 additions & 4 deletions src/liballoc/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use alloc::{Alloc, Layout, Global};
use core::cmp;
use core::mem;
use core::ops::Drop;
use core::ptr::{self, NonNull, Unique};
use core::slice;
use super::boxed::Box;
use super::allocator::CollectionAllocErr;
use super::allocator::CollectionAllocErr::*;

use alloc::{Alloc, Layout, Global};
use alloc::CollectionAllocErr;
use alloc::CollectionAllocErr::*;
use boxed::Box;

/// A low-level utility for more ergonomically allocating, reallocating, and deallocating
/// a buffer of memory on the heap without having to worry about all the corner cases
Expand Down
6 changes: 3 additions & 3 deletions src/liballoc/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ use core::mem;
use core::ptr;
use core::iter::FusedIterator;

use vec_deque::VecDeque;
use borrow::{Borrow, ToOwned};
use boxed::Box;
use slice::{SliceConcatExt, SliceIndex};
use string::String;
use vec::Vec;
use slice::{SliceConcatExt, SliceIndex};
use boxed::Box;
use vec_deque::VecDeque;

#[stable(feature = "rust1", since = "1.0.0")]
pub use core::str::{FromStr, Utf8Error};
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ use core::ptr;
use core::str::pattern::Pattern;
use core::str::lossy;

use alloc::CollectionAllocErr;
use borrow::{Cow, ToOwned};
use boxed::Box;
use str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars};
use vec::Vec;
use boxed::Box;
use super::allocator::CollectionAllocErr;

/// A UTF-8 encoded, growable string.
///
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ use core::ptr;
use core::ptr::NonNull;
use core::slice;

use alloc::CollectionAllocErr;
use borrow::ToOwned;
use borrow::Cow;
use boxed::Box;
use raw_vec::RawVec;
use super::allocator::CollectionAllocErr;

/// A contiguous growable array type, written `Vec<T>` but pronounced 'vector'.
///
Expand Down
5 changes: 2 additions & 3 deletions src/liballoc/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ use core::slice;
use core::hash::{Hash, Hasher};
use core::cmp;

use alloc::CollectionAllocErr;
use raw_vec::RawVec;

use super::allocator::CollectionAllocErr;
use super::vec::Vec;
use vec::Vec;

const INITIAL_CAPACITY: usize = 7; // 2^3 - 1
const MINIMUM_CAPACITY: usize = 1; // 2 - 1
Expand Down

0 comments on commit bd9ff84

Please sign in to comment.