Remove lots of numeric traits from the preludes

Num, NumCast, Unsigned, Float, Primitive and Int have been removed.
This commit is contained in:
Brendan Zabarauskas 2014-11-10 16:26:10 +11:00
parent 891559e30d
commit e965ba85ca
48 changed files with 100 additions and 66 deletions

View file

@ -13,6 +13,7 @@
// ignore-lexer-test FIXME #15679
use std::f32::consts::PI;
use std::num::{Float, FloatMath};
use std::rand::{Rng, StdRng};
struct Vec2 {

View file

@ -43,6 +43,7 @@
use std::io;
use std::io::{BufferedWriter, File};
use std::cmp::min;
use std::num::Float;
use std::os;
const LINE_LENGTH: uint = 60;

View file

@ -19,6 +19,7 @@ extern crate collections;
use std::collections::HashMap;
use std::mem::replace;
use std::num::Float;
use std::option;
use std::os;
use std::string::String;

View file

@ -38,6 +38,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
use std::num::Float;
const PI: f64 = 3.141592653589793;
const SOLAR_MASS: f64 = 4.0 * PI * PI;
const YEAR: f64 = 365.24;

View file

@ -45,6 +45,7 @@
use std::iter::AdditiveIterator;
use std::mem;
use std::num::Float;
use std::os;
use std::raw::Repr;
use std::simd::f64x2;

View file

@ -15,6 +15,7 @@
use std::io;
use std::io::stdio::StdReader;
use std::io::BufferedReader;
use std::num::Int;
use std::os;
// Computes a single solution to a given 9x9 sudoku

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::num::Int;
extern "C" fn foo<T: Int>(a: T, b: T) -> T { a + b }
fn main() {

View file

@ -11,6 +11,7 @@
extern crate collections;
use std::collections::Bitv;
use std::num::Float;
fn main() {
// Generate sieve of Eratosthenes for n up to 1e6

View file

@ -12,6 +12,7 @@
// A more complex example of numeric extensions
use std::cmp::{PartialEq, PartialOrd};
use std::num::NumCast;
pub trait TypeExt {}

View file

@ -11,11 +11,11 @@
use std::cmp::{PartialEq, PartialOrd};
use std::num::NumCast;
pub trait NumExt: PartialEq + PartialOrd + Num + NumCast {}
pub trait NumExt: PartialEq + PartialOrd + NumCast {}
impl NumExt for f32 {}
fn num_eq_one<T:NumExt>(n: T) {
fn num_eq_one<T: NumExt>(n: T) {
println!("{}", n == NumCast::from(1i).unwrap())
}