diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 661d6ec241a..ed923202795 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1188,7 +1188,7 @@ pub enum Type { PolyTraitRef(Vec), } -#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash)] +#[deriving(Clone, Copy, Encodable, Decodable, PartialEq, Eq, Hash)] pub enum PrimitiveType { Int, I8, I16, I32, I64, Uint, U8, U16, U32, U64, @@ -1200,9 +1200,7 @@ pub enum PrimitiveType { PrimitiveTuple, } -impl Copy for PrimitiveType {} - -#[deriving(Clone, Encodable, Decodable)] +#[deriving(Clone, Copy, Encodable, Decodable)] pub enum TypeKind { TypeEnum, TypeFunction, @@ -1215,8 +1213,6 @@ pub enum TypeKind { TypeTypedef, } -impl Copy for TypeKind {} - impl PrimitiveType { fn from_str(s: &str) -> Option { match s.as_slice() { @@ -1873,14 +1869,12 @@ impl Clean for doctree::Constant { } } -#[deriving(Show, Clone, Encodable, Decodable, PartialEq)] +#[deriving(Copy, Show, Clone, Encodable, Decodable, PartialEq)] pub enum Mutability { Mutable, Immutable, } -impl Copy for Mutability {} - impl Clean for ast::Mutability { fn clean(&self, _: &DocContext) -> Mutability { match self { diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index 6592ca498dc..83552884d7f 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -70,7 +70,7 @@ impl Module { } } -#[deriving(Show, Clone, Encodable, Decodable)] +#[deriving(Copy, Show, Clone, Encodable, Decodable)] pub enum StructType { /// A normal struct Plain, @@ -82,8 +82,6 @@ pub enum StructType { Unit } -impl Copy for StructType {} - pub enum TypeBound { RegionBound, TraitBound(ast::TraitRef) diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 1e243906b23..5572bcb6aa8 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -29,15 +29,19 @@ use html::render::{cache, CURRENT_LOCATION_KEY}; /// Helper to render an optional visibility with a space after it (if the /// visibility is preset) +#[deriving(Copy)] pub struct VisSpace(pub Option); /// Similarly to VisSpace, this structure is used to render a function style with a /// space after it. +#[deriving(Copy)] pub struct UnsafetySpace(pub ast::Unsafety); /// Wrapper struct for properly emitting a method declaration. pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl); /// Similar to VisSpace, but used for mutability +#[deriving(Copy)] pub struct MutableSpace(pub clean::Mutability); /// Similar to VisSpace, but used for mutability +#[deriving(Copy)] pub struct RawMutableSpace(pub clean::Mutability); /// Wrapper struct for properly emitting the stability level. pub struct Stability<'a>(pub &'a Option); @@ -48,11 +52,6 @@ pub struct WhereClause<'a>(pub &'a clean::Generics); /// Wrapper struct for emitting type parameter bounds. pub struct TyParamBounds<'a>(pub &'a [clean::TyParamBound]); -impl Copy for VisSpace {} -impl Copy for UnsafetySpace {} -impl Copy for MutableSpace {} -impl Copy for RawMutableSpace {} - impl VisSpace { pub fn get(&self) -> Option { let VisSpace(v) = *self; v diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs index 580b7fbe1a3..7c346539f6a 100644 --- a/src/librustdoc/html/item_type.rs +++ b/src/librustdoc/html/item_type.rs @@ -19,7 +19,7 @@ use clean; /// discriminants. JavaScript then is used to decode them into the original value. /// Consequently, every change to this type should be synchronized to /// the `itemTypes` mapping table in `static/main.js`. -#[deriving(PartialEq, Clone)] +#[deriving(Copy, PartialEq, Clone)] pub enum ItemType { Module = 0, Struct = 1, @@ -41,8 +41,6 @@ pub enum ItemType { Constant = 18, } -impl Copy for ItemType {} - impl ItemType { pub fn from_item(item: &clean::Item) -> ItemType { match item.inner { diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 3e6cffa1304..8831b5e7d96 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -225,13 +225,12 @@ struct Source<'a>(&'a str); // Helper structs for rendering items/sidebars and carrying along contextual // information +#[deriving(Copy)] struct Item<'a> { cx: &'a Context, item: &'a clean::Item, } -impl<'a> Copy for Item<'a> {} - struct Sidebar<'a> { cx: &'a Context, item: &'a clean::Item, } /// Struct representing one entry in the JS search index. These are all emitted diff --git a/src/librustdoc/stability_summary.rs b/src/librustdoc/stability_summary.rs index 4fbd249660f..2f3079f75b9 100644 --- a/src/librustdoc/stability_summary.rs +++ b/src/librustdoc/stability_summary.rs @@ -27,6 +27,7 @@ use html::render::cache; #[deriving(Zero, Encodable, Decodable, PartialEq, Eq)] /// The counts for each stability level. +#[deriving(Copy)] pub struct Counts { pub deprecated: uint, pub experimental: uint, @@ -39,8 +40,6 @@ pub struct Counts { pub unmarked: uint, } -impl Copy for Counts {} - impl Add for Counts { fn add(self, other: Counts) -> Counts { Counts {