From 6efbbf2e1481c3f42d7bd1cd7008fdc54939d9d3 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Fri, 26 Apr 2013 19:56:11 +1000 Subject: Combine PrimitiveInt, Int, and Uint traits into one single trait MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Having three traits for primitive ints/uints seemed rather excessive. If users wish to specify between them they can simply combine Int with either the Signed and Unsigned traits. For example: fn foo() { … } --- src/libcore/num/int-template.rs | 2 -- src/libcore/num/num.rs | 22 +++++----------------- src/libcore/num/uint-template.rs | 4 +--- 3 files changed, 6 insertions(+), 22 deletions(-) (limited to 'src/libcore/num') diff --git a/src/libcore/num/int-template.rs b/src/libcore/num/int-template.rs index 11dacdd4493..0c126bd1de5 100644 --- a/src/libcore/num/int-template.rs +++ b/src/libcore/num/int-template.rs @@ -445,8 +445,6 @@ impl Bounded for T { fn max_value() -> T { max_value } } -impl PrimitiveInt for T {} - impl Int for T {} // String conversion functions and impl str -> num diff --git a/src/libcore/num/num.rs b/src/libcore/num/num.rs index cec5fe8cd28..f1a77a4ed59 100644 --- a/src/libcore/num/num.rs +++ b/src/libcore/num/num.rs @@ -217,23 +217,11 @@ pub trait Primitive: Num /// /// A collection of traits relevant to primitive signed and unsigned integers /// -pub trait PrimitiveInt: Integer - + Primitive - + Bounded - + Bitwise - + BitCount {} - -/// -/// Specialisation of `PrimitiveInt` for unsigned integers -/// -pub trait Uint: PrimitiveInt - + Unsigned {} - -/// -/// Specialisation of `PrimitiveInt` for signed integers -/// -pub trait Int: PrimitiveInt - + Signed {} +pub trait Int: Integer + + Primitive + + Bounded + + Bitwise + + BitCount {} /// /// Primitive floating point numbers. This trait should only be implemented diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs index 2e6c7e28b18..d84f4a99d53 100644 --- a/src/libcore/num/uint-template.rs +++ b/src/libcore/num/uint-template.rs @@ -277,9 +277,7 @@ impl Bounded for T { fn max_value() -> T { max_value } } -impl PrimitiveInt for T {} - -impl Uint for T {} +impl Int for T {} // String conversion functions and impl str -> num -- cgit 1.4.1-3-g733a5