Skip to content

Commit a8cf28d

Browse files
committed
Stop using deriving for types with phantom params
1 parent 2064ba8 commit a8cf28d

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/types/range.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Types dealing with ranges of values
22
#[macro_escape];
33

4-
extern crate extra;
5-
64
use std::cmp;
75
use std::fmt;
86
use std::i32;
@@ -141,11 +139,9 @@ trait BoundSided {
141139
}
142140

143141
/// A tag type representing an upper bound
144-
#[deriving(Eq,Clone)]
145142
pub enum UpperBound {}
146143

147144
/// A tag type representing a lower bound
148-
#[deriving(Eq,Clone)]
149145
pub enum LowerBound {}
150146

151147
impl BoundSided for UpperBound {
@@ -172,14 +168,22 @@ pub enum BoundType {
172168
/// Represents a one-sided bound.
173169
///
174170
/// The side is determined by the `S` phantom parameter.
175-
#[deriving(Clone)]
176171
pub struct RangeBound<S, T> {
177172
/// The value of the bound
178173
value: T,
179174
/// The type of the bound
180175
type_: BoundType
181176
}
182177

178+
impl<S: BoundSided, T: Clone> Clone for RangeBound<S, T> {
179+
fn clone(&self) -> RangeBound<S, T> {
180+
RangeBound {
181+
value: self.value.clone(),
182+
type_: self.type_.clone(),
183+
}
184+
}
185+
}
186+
183187
impl<S: BoundSided, T: fmt::Show> fmt::Show for RangeBound<S, T> {
184188
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
185189
let chars = match self.type_ {

0 commit comments

Comments
 (0)