Skip to content

Commit

Permalink
Derive Clone when deriving Copy
Browse files Browse the repository at this point in the history
As per rust-lang/rust#23860, Copy now extends
Clone.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
  • Loading branch information
andersk committed Apr 3, 2015
1 parent d7dff70 commit ef044ab
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/gif/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use super::{Extension, Block, DisposalMethod};

use math::nq;

#[derive(Debug, Copy)]
#[derive(Debug, Clone, Copy)]
#[allow(unused_qualifications)]
/// The color mode the encoder will use to encode the image.
pub enum ColorMode {
Expand Down
2 changes: 1 addition & 1 deletion src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub enum DecodingBuffer<'a> {

/// An enumeration of supported image formats.
/// Not all formats support both encoding and decoding.
#[derive(Copy, PartialEq, Eq, Debug)]
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum ImageFormat {
/// An Image in PNG Format
PNG,
Expand Down
2 changes: 1 addition & 1 deletion src/imageops/colorops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub trait ColorMap {
}

/// A bi-level color map
#[derive(Copy)]
#[derive(Clone, Copy)]
pub struct BiLevel;

impl ColorMap for BiLevel {
Expand Down
2 changes: 1 addition & 1 deletion src/imageops/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use image::GenericImage;
use math::utils::clamp;

/// Available Sampling Filters
#[derive(Copy)]
#[derive(Clone, Copy)]
pub enum FilterType {
/// Nearest Neighbor
Nearest,
Expand Down
2 changes: 1 addition & 1 deletion src/math/nq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const BETAGAMMA: f64 = BETA * GAMMA;
// that it is divisible by all four primes
const PRIMES: [usize; 4] = [499, 491, 478, 503];

#[derive(Copy)]
#[derive(Clone, Copy)]
struct Quad<T> {
r: T,
g: T,
Expand Down
6 changes: 3 additions & 3 deletions src/png/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use super::zlib::ZlibDecoder;
pub static PNGSIGNATURE: [u8; 8] = [137, 80, 78, 71, 13, 10, 26, 10];


#[derive(Copy, PartialEq)]
#[derive(Clone, Copy, PartialEq)]
enum PNGState {
Start,
HaveSignature,
Expand All @@ -33,7 +33,7 @@ enum PNGState {
HaveIEND
}

#[derive(Copy, FromPrimitive, Debug, PartialEq)]
#[derive(Clone, Copy, FromPrimitive, Debug, PartialEq)]
enum InterlaceMethod {
None = 0,
Adam7 = 1
Expand All @@ -51,7 +51,7 @@ enum InterlaceMethod {
/// 56565656
/// 77777777
///
#[derive(Copy)]
#[derive(Clone, Copy)]
struct Adam7Iterator {
line: u32,
lines: u32,
Expand Down
4 changes: 2 additions & 2 deletions src/png/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! *http://en.wikipedia.org/wiki/Cyclic_redundancy_check - Cyclic Redundancy Check
/// An Implementation of the Adler-32 checksum
#[derive(Copy)]
#[derive(Clone, Copy)]
pub struct Adler32 {
s1: u32,
s2: u32
Expand Down Expand Up @@ -97,7 +97,7 @@ const CRC_TABLE: [u32; 256] = [
];

/// An Implementation of the Crc-32 checksum
#[derive(Copy)]
#[derive(Clone, Copy)]
pub struct Crc32 {
crc: u32,
}
Expand Down
8 changes: 4 additions & 4 deletions src/tiff/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use super::stream::{
LZWReader
};

#[derive(Copy, Debug, FromPrimitive, PartialEq)]
#[derive(Clone, Copy, Debug, FromPrimitive, PartialEq)]
enum PhotometricInterpretation {
WhiteIsZero = 0,
BlackIsZero = 1,
Expand All @@ -37,7 +37,7 @@ enum PhotometricInterpretation {
CIELab = 8,
}

#[derive(Copy, Debug, FromPrimitive)]
#[derive(Clone, Copy, Debug, FromPrimitive)]
enum CompressionMethod {
None = 1,
Huffman = 2,
Expand All @@ -48,13 +48,13 @@ enum CompressionMethod {
PackBits = 32773
}

#[derive(Copy, Debug, FromPrimitive)]
#[derive(Clone, Copy, Debug, FromPrimitive)]
enum PlanarConfiguration {
Chunky = 1,
Planar = 2
}

#[derive(Copy, Debug, FromPrimitive)]
#[derive(Clone, Copy, Debug, FromPrimitive)]
enum Predictor {
None = 1,
Horizontal = 2
Expand Down
4 changes: 2 additions & 2 deletions src/tiff/ifd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ macro_rules! tags {
)*} => {

/// TIFF tag
#[derive(Copy, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
pub enum Tag {
$($tag,)*
Unknown(u16)
Expand Down Expand Up @@ -74,7 +74,7 @@ tags!{
Predictor 317;
}

#[derive(Copy, Debug, FromPrimitive)]
#[derive(Clone, Copy, Debug, FromPrimitive)]
pub enum Type {
BYTE = 1,
ASCII = 2,
Expand Down
2 changes: 1 addition & 1 deletion src/tiff/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use byteorder::{self, ReadBytesExt, BigEndian, LittleEndian};
use utils::{lzw, bitstream};

/// Byte order of the TIFF file.
#[derive(Copy, Debug)]
#[derive(Clone, Copy, Debug)]
pub enum ByteOrder {
/// little endian byte order
LittleEndian,
Expand Down
4 changes: 2 additions & 2 deletions src/webp/vp8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ impl BoolReader {
}
}

#[derive(Copy)]
#[derive(Clone, Copy)]
struct MacroBlock {
bpred: [i8; 16],
complexity: [u8; 9],
Expand Down Expand Up @@ -780,7 +780,7 @@ pub struct Frame {
sharpness_level: u8,
}

#[derive(Copy, Default)]
#[derive(Clone, Copy, Default)]
struct Segment {
ydc: i16,
yac: i16,
Expand Down

0 comments on commit ef044ab

Please sign in to comment.