Skip to content

Commit ce92437

Browse files
author
Jorge Aparicio
committed
libtest: use #[deriving(Copy)]
1 parent 64234b3 commit ce92437

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/libtest/lib.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,13 @@ impl Show for TestName {
110110
}
111111
}
112112

113-
#[deriving(Clone)]
113+
#[deriving(Clone, Copy)]
114114
enum NamePadding {
115115
PadNone,
116116
PadOnLeft,
117117
PadOnRight,
118118
}
119119

120-
impl Copy for NamePadding {}
121-
122120
impl TestDesc {
123121
fn padded_name(&self, column_count: uint, align: NamePadding) -> String {
124122
let mut name = String::from_str(self.name.as_slice());
@@ -215,14 +213,12 @@ pub struct TestDescAndFn {
215213
pub testfn: TestFn,
216214
}
217215

218-
#[deriving(Clone, Encodable, Decodable, PartialEq, Show)]
216+
#[deriving(Clone, Copy, Encodable, Decodable, PartialEq, Show)]
219217
pub struct Metric {
220218
value: f64,
221219
noise: f64
222220
}
223221

224-
impl Copy for Metric {}
225-
226222
impl Metric {
227223
pub fn new(value: f64, noise: f64) -> Metric {
228224
Metric {value: value, noise: noise}
@@ -240,7 +236,7 @@ impl Clone for MetricMap {
240236
}
241237

242238
/// Analysis of a single change in metric
243-
#[deriving(PartialEq, Show)]
239+
#[deriving(Copy, PartialEq, Show)]
244240
pub enum MetricChange {
245241
LikelyNoise,
246242
MetricAdded,
@@ -249,8 +245,6 @@ pub enum MetricChange {
249245
Regression(f64)
250246
}
251247

252-
impl Copy for MetricChange {}
253-
254248
pub type MetricDiff = BTreeMap<String,MetricChange>;
255249

256250
// The default console test runner. It accepts the command line
@@ -287,14 +281,13 @@ pub fn test_main_static(args: &[String], tests: &[TestDescAndFn]) {
287281
test_main(args, owned_tests)
288282
}
289283

284+
#[deriving(Copy)]
290285
pub enum ColorConfig {
291286
AutoColor,
292287
AlwaysColor,
293288
NeverColor,
294289
}
295290

296-
impl Copy for ColorConfig {}
297-
298291
pub struct TestOpts {
299292
pub filter: Option<Regex>,
300293
pub run_ignored: bool,

0 commit comments

Comments
 (0)