about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2014-12-14 23:17:42 -0500
committerJorge Aparicio <japaricious@gmail.com>2014-12-19 10:51:00 -0500
commit4c007568bfb27fc4ac6cc2dd485099836c6af702 (patch)
tree2c7bfa0374af91e73ece40818f4ee847ac5fdda1
parentfa0383f38d4b165ad2285efade1bbdbb780cdfe5 (diff)
downloadrust-4c007568bfb27fc4ac6cc2dd485099836c6af702.tar.gz
rust-4c007568bfb27fc4ac6cc2dd485099836c6af702.zip
librustdoc: use `#[deriving(Copy)]`
-rw-r--r--src/librustdoc/clean/mod.rs12
-rw-r--r--src/librustdoc/doctree.rs4
-rw-r--r--src/librustdoc/html/format.rs9
-rw-r--r--src/librustdoc/html/item_type.rs4
-rw-r--r--src/librustdoc/html/render.rs3
-rw-r--r--src/librustdoc/stability_summary.rs3
6 files changed, 11 insertions, 24 deletions
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<TyParamBound>),
 }
 
-#[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<PrimitiveType> {
         match s.as_slice() {
@@ -1873,14 +1869,12 @@ impl Clean<Item> 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<Mutability> 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<ast::Visibility>);
 /// 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<clean::Stability>);
@@ -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<ast::Visibility> {
         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<Counts, Counts> for Counts {
     fn add(self, other: Counts) -> Counts {
         Counts {