librustdoc: use #[deriving(Copy)]
This commit is contained in:
parent
fa0383f38d
commit
4c007568bf
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user