librustdoc: use #[deriving(Copy)]
This commit is contained in:
parent
fa0383f38d
commit
4c007568bf
6 changed files with 11 additions and 24 deletions
|
@ -1188,7 +1188,7 @@ pub enum Type {
|
||||||
PolyTraitRef(Vec<TyParamBound>),
|
PolyTraitRef(Vec<TyParamBound>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash)]
|
#[deriving(Clone, Copy, Encodable, Decodable, PartialEq, Eq, Hash)]
|
||||||
pub enum PrimitiveType {
|
pub enum PrimitiveType {
|
||||||
Int, I8, I16, I32, I64,
|
Int, I8, I16, I32, I64,
|
||||||
Uint, U8, U16, U32, U64,
|
Uint, U8, U16, U32, U64,
|
||||||
|
@ -1200,9 +1200,7 @@ pub enum PrimitiveType {
|
||||||
PrimitiveTuple,
|
PrimitiveTuple,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for PrimitiveType {}
|
#[deriving(Clone, Copy, Encodable, Decodable)]
|
||||||
|
|
||||||
#[deriving(Clone, Encodable, Decodable)]
|
|
||||||
pub enum TypeKind {
|
pub enum TypeKind {
|
||||||
TypeEnum,
|
TypeEnum,
|
||||||
TypeFunction,
|
TypeFunction,
|
||||||
|
@ -1215,8 +1213,6 @@ pub enum TypeKind {
|
||||||
TypeTypedef,
|
TypeTypedef,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for TypeKind {}
|
|
||||||
|
|
||||||
impl PrimitiveType {
|
impl PrimitiveType {
|
||||||
fn from_str(s: &str) -> Option<PrimitiveType> {
|
fn from_str(s: &str) -> Option<PrimitiveType> {
|
||||||
match s.as_slice() {
|
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 {
|
pub enum Mutability {
|
||||||
Mutable,
|
Mutable,
|
||||||
Immutable,
|
Immutable,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Mutability {}
|
|
||||||
|
|
||||||
impl Clean<Mutability> for ast::Mutability {
|
impl Clean<Mutability> for ast::Mutability {
|
||||||
fn clean(&self, _: &DocContext) -> Mutability {
|
fn clean(&self, _: &DocContext) -> Mutability {
|
||||||
match self {
|
match self {
|
||||||
|
|
|
@ -70,7 +70,7 @@ impl Module {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Show, Clone, Encodable, Decodable)]
|
#[deriving(Copy, Show, Clone, Encodable, Decodable)]
|
||||||
pub enum StructType {
|
pub enum StructType {
|
||||||
/// A normal struct
|
/// A normal struct
|
||||||
Plain,
|
Plain,
|
||||||
|
@ -82,8 +82,6 @@ pub enum StructType {
|
||||||
Unit
|
Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for StructType {}
|
|
||||||
|
|
||||||
pub enum TypeBound {
|
pub enum TypeBound {
|
||||||
RegionBound,
|
RegionBound,
|
||||||
TraitBound(ast::TraitRef)
|
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
|
/// Helper to render an optional visibility with a space after it (if the
|
||||||
/// visibility is preset)
|
/// visibility is preset)
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct VisSpace(pub Option<ast::Visibility>);
|
pub struct VisSpace(pub Option<ast::Visibility>);
|
||||||
/// Similarly to VisSpace, this structure is used to render a function style with a
|
/// Similarly to VisSpace, this structure is used to render a function style with a
|
||||||
/// space after it.
|
/// space after it.
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct UnsafetySpace(pub ast::Unsafety);
|
pub struct UnsafetySpace(pub ast::Unsafety);
|
||||||
/// Wrapper struct for properly emitting a method declaration.
|
/// Wrapper struct for properly emitting a method declaration.
|
||||||
pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl);
|
pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl);
|
||||||
/// Similar to VisSpace, but used for mutability
|
/// Similar to VisSpace, but used for mutability
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct MutableSpace(pub clean::Mutability);
|
pub struct MutableSpace(pub clean::Mutability);
|
||||||
/// Similar to VisSpace, but used for mutability
|
/// Similar to VisSpace, but used for mutability
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct RawMutableSpace(pub clean::Mutability);
|
pub struct RawMutableSpace(pub clean::Mutability);
|
||||||
/// Wrapper struct for properly emitting the stability level.
|
/// Wrapper struct for properly emitting the stability level.
|
||||||
pub struct Stability<'a>(pub &'a Option<clean::Stability>);
|
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.
|
/// Wrapper struct for emitting type parameter bounds.
|
||||||
pub struct TyParamBounds<'a>(pub &'a [clean::TyParamBound]);
|
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 {
|
impl VisSpace {
|
||||||
pub fn get(&self) -> Option<ast::Visibility> {
|
pub fn get(&self) -> Option<ast::Visibility> {
|
||||||
let VisSpace(v) = *self; v
|
let VisSpace(v) = *self; v
|
||||||
|
|
|
@ -19,7 +19,7 @@ use clean;
|
||||||
/// discriminants. JavaScript then is used to decode them into the original value.
|
/// discriminants. JavaScript then is used to decode them into the original value.
|
||||||
/// Consequently, every change to this type should be synchronized to
|
/// Consequently, every change to this type should be synchronized to
|
||||||
/// the `itemTypes` mapping table in `static/main.js`.
|
/// the `itemTypes` mapping table in `static/main.js`.
|
||||||
#[deriving(PartialEq, Clone)]
|
#[deriving(Copy, PartialEq, Clone)]
|
||||||
pub enum ItemType {
|
pub enum ItemType {
|
||||||
Module = 0,
|
Module = 0,
|
||||||
Struct = 1,
|
Struct = 1,
|
||||||
|
@ -41,8 +41,6 @@ pub enum ItemType {
|
||||||
Constant = 18,
|
Constant = 18,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ItemType {}
|
|
||||||
|
|
||||||
impl ItemType {
|
impl ItemType {
|
||||||
pub fn from_item(item: &clean::Item) -> ItemType {
|
pub fn from_item(item: &clean::Item) -> ItemType {
|
||||||
match item.inner {
|
match item.inner {
|
||||||
|
|
|
@ -225,13 +225,12 @@ struct Source<'a>(&'a str);
|
||||||
// Helper structs for rendering items/sidebars and carrying along contextual
|
// Helper structs for rendering items/sidebars and carrying along contextual
|
||||||
// information
|
// information
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
struct Item<'a> {
|
struct Item<'a> {
|
||||||
cx: &'a Context,
|
cx: &'a Context,
|
||||||
item: &'a clean::Item,
|
item: &'a clean::Item,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Copy for Item<'a> {}
|
|
||||||
|
|
||||||
struct Sidebar<'a> { cx: &'a Context, item: &'a clean::Item, }
|
struct Sidebar<'a> { cx: &'a Context, item: &'a clean::Item, }
|
||||||
|
|
||||||
/// Struct representing one entry in the JS search index. These are all emitted
|
/// 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)]
|
#[deriving(Zero, Encodable, Decodable, PartialEq, Eq)]
|
||||||
/// The counts for each stability level.
|
/// The counts for each stability level.
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct Counts {
|
pub struct Counts {
|
||||||
pub deprecated: uint,
|
pub deprecated: uint,
|
||||||
pub experimental: uint,
|
pub experimental: uint,
|
||||||
|
@ -39,8 +40,6 @@ pub struct Counts {
|
||||||
pub unmarked: uint,
|
pub unmarked: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Counts {}
|
|
||||||
|
|
||||||
impl Add<Counts, Counts> for Counts {
|
impl Add<Counts, Counts> for Counts {
|
||||||
fn add(self, other: Counts) -> Counts {
|
fn add(self, other: Counts) -> Counts {
|
||||||
Counts {
|
Counts {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue