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/raw_vec.rs | |
| parent | e858c2637fa5bac40ac450628b30c56c2b4327b4 (diff) | |
| parent | 2396780cdaedf097dd6a8f3927749bcaf5b1238b (diff) | |
| download | rust-4f4f4a40b6c7bcb6fa07ee6575e8a9759ba08922.tar.gz rust-4f4f4a40b6c7bcb6fa07ee6575e8a9759ba08922.zip | |
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/raw_vec.rs')
| -rw-r--r-- | src/liballoc/raw_vec.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index 5e4aac9ce78..dcecf9bc76d 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -7,10 +7,9 @@ use core::ops::Drop; use core::ptr::{self, NonNull, Unique}; use core::slice; -use alloc::{Alloc, Layout, Global, handle_alloc_error}; -use collections::CollectionAllocErr; -use collections::CollectionAllocErr::*; -use boxed::Box; +use crate::alloc::{Alloc, Layout, Global, handle_alloc_error}; +use crate::collections::CollectionAllocErr::{self, *}; +use crate::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 @@ -621,14 +620,14 @@ enum Fallibility { Infallible, } -use self::Fallibility::*; +use Fallibility::*; enum ReserveStrategy { Exact, Amortized, } -use self::ReserveStrategy::*; +use ReserveStrategy::*; impl<T, A: Alloc> RawVec<T, A> { fn reserve_internal( @@ -639,7 +638,7 @@ impl<T, A: Alloc> RawVec<T, A> { strategy: ReserveStrategy, ) -> Result<(), CollectionAllocErr> { unsafe { - use alloc::AllocErr; + use crate::alloc::AllocErr; // NOTE: we don't early branch on ZSTs here because we want this // to actually catch "asking for more than usize::MAX" in that case. @@ -733,7 +732,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(()) @@ -753,7 +752,7 @@ mod tests { #[test] fn allocator_param() { - use alloc::AllocErr; + use crate::alloc::AllocErr; // Writing a test of integration between third-party // allocators and RawVec is a little tricky because the RawVec |
