diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-04-17 23:45:55 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-04-21 15:23:54 -0700 |
| commit | a568a7f9f2eb3fa3f3e049df288ef0ad32cc7881 (patch) | |
| tree | 2d96b295e43de338e7e650110ba00ac2e116b519 /src/test | |
| parent | 0791f9f406053d84dc7136c2be015a469304d7f0 (diff) | |
| download | rust-a568a7f9f2eb3fa3f3e049df288ef0ad32cc7881.tar.gz rust-a568a7f9f2eb3fa3f3e049df288ef0ad32cc7881.zip | |
std: Bring back f32::from_str_radix as an unstable API
This API was exercised in a few tests and mirrors the `from_str_radix` functionality of the integer types.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/bench/noise.rs | 1 | ||||
| -rw-r--r-- | src/test/bench/shootout-binarytrees.rs | 3 | ||||
| -rw-r--r-- | src/test/bench/shootout-fasta.rs | 1 | ||||
| -rw-r--r-- | src/test/bench/shootout-nbody.rs | 21 | ||||
| -rw-r--r-- | src/test/bench/shootout-spectralnorm.rs | 1 | ||||
| -rw-r--r-- | src/test/bench/sudoku.rs | 1 | ||||
| -rw-r--r-- | src/test/pretty/default-trait-impl.rs | 6 |
7 files changed, 9 insertions, 25 deletions
diff --git a/src/test/bench/noise.rs b/src/test/bench/noise.rs index 530c499f5fd..efbb5dfb549 100644 --- a/src/test/bench/noise.rs +++ b/src/test/bench/noise.rs @@ -14,7 +14,6 @@ #![feature(rand, core)] use std::f32::consts::PI; -use std::num::Float; use std::__rand::{Rng, thread_rng}; #[derive(Copy, Clone)] diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index 61fe6593dc3..c576eea3602 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -109,8 +109,7 @@ fn main() { let long_lived_tree = bottom_up_tree(&long_lived_arena, 0, max_depth); let messages = (min_depth..max_depth + 1).step_by(2).map(|depth| { - use std::num::Int; - let iterations = 2.pow((max_depth - depth + min_depth) as u32); + let iterations = 2i32.pow((max_depth - depth + min_depth) as u32); thread::spawn(move || inner(depth, iterations)) }).collect::<Vec<_>>(); diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs index 0474cfb6fc8..accf525b4e6 100644 --- a/src/test/bench/shootout-fasta.rs +++ b/src/test/bench/shootout-fasta.rs @@ -43,7 +43,6 @@ use std::env; use std::fs::File; use std::io::{self, BufWriter}; use std::io::prelude::*; -use std::num::Float; const LINE_LENGTH: usize = 60; const IM: u32 = 139968; diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs index de7fb737958..368dbbb931c 100644 --- a/src/test/bench/shootout-nbody.rs +++ b/src/test/bench/shootout-nbody.rs @@ -38,9 +38,7 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. -#![feature(core)] - -use std::num::Float; +use std::mem; const PI: f64 = 3.141592653589793; const SOLAR_MASS: f64 = 4.0 * PI * PI; @@ -193,16 +191,9 @@ fn main() { /// longer contain the mutable reference. This is a safe operation because the /// two mutable borrows are entirely disjoint. fn shift_mut_ref<'a, T>(r: &mut &'a mut [T]) -> Option<&'a mut T> { - use std::mem; - use std::raw::Repr; - - if r.is_empty() { return None } - unsafe { - let mut raw = r.repr(); - let ret = raw.data as *mut T; - raw.data = raw.data.offset(1); - raw.len -= 1; - *r = mem::transmute(raw); - Some({ &mut *ret }) - } + let res = mem::replace(r, &mut []); + if res.is_empty() { return None } + let (a, b) = res.split_at_mut(1); + *r = b; + Some(&mut a[0]) } diff --git a/src/test/bench/shootout-spectralnorm.rs b/src/test/bench/shootout-spectralnorm.rs index b0e8c395673..0fa22abde3c 100644 --- a/src/test/bench/shootout-spectralnorm.rs +++ b/src/test/bench/shootout-spectralnorm.rs @@ -46,7 +46,6 @@ use std::iter::repeat; use std::thread; use std::mem; -use std::num::Float; use std::os; use std::env; use std::raw::Repr; diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index 3913de3a3f9..16742f0a6e1 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -16,7 +16,6 @@ use std::io::prelude::*; use std::io; use std::iter::repeat; -use std::num::Int; use std::env; // Computes a single solution to a given 9x9 sudoku diff --git a/src/test/pretty/default-trait-impl.rs b/src/test/pretty/default-trait-impl.rs index 509bee9def2..a5246b9300c 100644 --- a/src/test/pretty/default-trait-impl.rs +++ b/src/test/pretty/default-trait-impl.rs @@ -8,13 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(optin_builtin_traits, core)] +#![feature(optin_builtin_traits)] // pp-exact -use std::marker::MarkerTrait; - -trait MyTrait: MarkerTrait { } +trait MyTrait { } impl MyTrait for .. { } |
