diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-01-27 22:24:02 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-01-27 22:24:02 +0530 |
| commit | 51ff9e82ec4ffe4d80765707e7348f34cecdc250 (patch) | |
| tree | a71aba9870dda909a76530b8765da538c6c2907b /src/test/bench | |
| parent | 8418725b0daf6defc98137695e4fcc660f3cdb8f (diff) | |
| parent | bff462302b3e0a8f68c14cad2806c7ff5005364e (diff) | |
Rollup merge of #21602 - japaric:derive-copy, r=alexcrichton
Diffstat (limited to 'src/test/bench')
| -rw-r--r-- | src/test/bench/noise.rs | 3 | ||||
| -rw-r--r-- | src/test/bench/shootout-chameneos-redux.rs | 6 | ||||
| -rw-r--r-- | src/test/bench/shootout-fannkuch-redux.rs | 6 | ||||
| -rw-r--r-- | src/test/bench/shootout-fasta-redux.rs | 3 | ||||
| -rw-r--r-- | src/test/bench/shootout-k-nucleotide.rs | 4 | ||||
| -rw-r--r-- | src/test/bench/shootout-nbody.rs | 3 |
6 files changed, 8 insertions, 17 deletions
diff --git a/src/test/bench/noise.rs b/src/test/bench/noise.rs index 3c7efb0336a..75edd64fb2e 100644 --- a/src/test/bench/noise.rs +++ b/src/test/bench/noise.rs @@ -16,13 +16,12 @@ use std::f32::consts::PI; use std::num::Float; use std::rand::{Rng, StdRng}; +#[derive(Copy)] struct Vec2 { x: f32, y: f32, } -impl Copy for Vec2 {} - fn lerp(a: f32, b: f32, v: f32) -> f32 { a * (1.0 - v) + b * v } fn smooth(v: f32) -> f32 { v * v * (3.0 - 2.0 * v) } diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index 33995a9be74..12dc224a82f 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -54,14 +54,13 @@ fn print_complements() { } } +#[derive(Copy)] enum Color { Red, Yellow, Blue, } -impl Copy for Color {} - impl fmt::Show for Color { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let str = match *self { @@ -73,13 +72,12 @@ impl fmt::Show for Color { } } +#[derive(Copy)] struct CreatureInfo { name: uint, color: Color } -impl Copy for CreatureInfo {} - fn show_color_list(set: Vec<Color>) -> String { let mut out = String::new(); for col in set.iter() { diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs index daabae88bdf..42b41d955fb 100644 --- a/src/test/bench/shootout-fannkuch-redux.rs +++ b/src/test/bench/shootout-fannkuch-redux.rs @@ -61,12 +61,12 @@ fn next_permutation(perm: &mut [i32], count: &mut [i32]) { } } +#[derive(Copy)] struct P { p: [i32; 16], } -impl Copy for P {} - +#[derive(Copy)] struct Perm { cnt: [i32; 16], fact: [u32; 16], @@ -75,8 +75,6 @@ struct Perm { perm: P, } -impl Copy for Perm {} - impl Perm { fn new(n: u32) -> Perm { let mut fact = [1; 16]; diff --git a/src/test/bench/shootout-fasta-redux.rs b/src/test/bench/shootout-fasta-redux.rs index 32242bee801..37e64aca324 100644 --- a/src/test/bench/shootout-fasta-redux.rs +++ b/src/test/bench/shootout-fasta-redux.rs @@ -103,13 +103,12 @@ fn sum_and_scale(a: &'static [AminoAcid]) -> Vec<AminoAcid> { result } +#[derive(Copy)] struct AminoAcid { c: u8, p: f32, } -impl Copy for AminoAcid {} - struct RepeatFasta<'a, W:'a> { alu: &'static str, out: &'a mut W diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 657ae537f21..1bfd6a6301a 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -60,11 +60,9 @@ static OCCURRENCES: [&'static str;5] = [ // Code implementation -#[derive(PartialEq, PartialOrd, Ord, Eq)] +#[derive(Copy, PartialEq, PartialOrd, Ord, Eq)] struct Code(u64); -impl Copy for Code {} - impl Code { fn hash(&self) -> u64 { let Code(ret) = *self; diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs index c65f98e545b..1b3d66ca7d2 100644 --- a/src/test/bench/shootout-nbody.rs +++ b/src/test/bench/shootout-nbody.rs @@ -94,14 +94,13 @@ static BODIES: [Planet;N_BODIES] = [ }, ]; +#[derive(Copy)] struct Planet { x: f64, y: f64, z: f64, vx: f64, vy: f64, vz: f64, mass: f64, } -impl Copy for Planet {} - fn advance(bodies: &mut [Planet;N_BODIES], dt: f64, steps: int) { for _ in range(0, steps) { let mut b_slice = bodies.as_mut_slice(); |
