Skip to content

Commit 7b4c508

Browse files
committed
rustdoc: Add Show impls to more clean types
1 parent 6da8827 commit 7b4c508

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<T: Clean<U>, U> Clean<Vec<U>> for syntax::owned_slice::OwnedSlice<T> {
116116
}
117117
}
118118

119-
#[derive(Clone, RustcEncodable, RustcDecodable)]
119+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
120120
pub struct Crate {
121121
pub name: String,
122122
pub src: FsPath,
@@ -198,7 +198,7 @@ impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> {
198198
}
199199
}
200200

201-
#[derive(Clone, RustcEncodable, RustcDecodable)]
201+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
202202
pub struct ExternalCrate {
203203
pub name: String,
204204
pub attrs: Vec<Attribute>,
@@ -231,7 +231,7 @@ impl Clean<ExternalCrate> for cstore::crate_metadata {
231231
/// Anything with a source location and set of attributes and, optionally, a
232232
/// name. That is, anything that can be documented. This doesn't correspond
233233
/// directly to the AST's concept of an item; it's a strict superset.
234-
#[derive(Clone, RustcEncodable, RustcDecodable)]
234+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
235235
pub struct Item {
236236
/// Stringified span
237237
pub source: Span,
@@ -307,7 +307,7 @@ impl Item {
307307
}
308308
}
309309

310-
#[derive(Clone, RustcEncodable, RustcDecodable)]
310+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
311311
pub enum ItemEnum {
312312
StructItem(Struct),
313313
EnumItem(Enum),
@@ -336,7 +336,7 @@ pub enum ItemEnum {
336336
AssociatedTypeItem(TyParam),
337337
}
338338

339-
#[derive(Clone, RustcEncodable, RustcDecodable)]
339+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
340340
pub struct Module {
341341
pub items: Vec<Item>,
342342
pub is_crate: bool,
@@ -938,7 +938,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics<'tcx>, subst::ParamSpace) {
938938
}
939939
}
940940

941-
#[derive(Clone, RustcEncodable, RustcDecodable)]
941+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
942942
pub struct Method {
943943
pub generics: Generics,
944944
pub self_: SelfTy,
@@ -977,7 +977,7 @@ impl Clean<Item> for ast::Method {
977977
}
978978
}
979979

980-
#[derive(Clone, RustcEncodable, RustcDecodable)]
980+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
981981
pub struct TyMethod {
982982
pub unsafety: ast::Unsafety,
983983
pub decl: FnDecl,
@@ -1015,7 +1015,7 @@ impl Clean<Item> for ast::TypeMethod {
10151015
}
10161016
}
10171017

1018-
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
1018+
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)]
10191019
pub enum SelfTy {
10201020
SelfStatic,
10211021
SelfValue,
@@ -1036,7 +1036,7 @@ impl Clean<SelfTy> for ast::ExplicitSelf_ {
10361036
}
10371037
}
10381038

1039-
#[derive(Clone, RustcEncodable, RustcDecodable)]
1039+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
10401040
pub struct Function {
10411041
pub decl: FnDecl,
10421042
pub generics: Generics,
@@ -1153,7 +1153,7 @@ impl Clean<FunctionRetTy> for ast::FunctionRetTy {
11531153
}
11541154
}
11551155

1156-
#[derive(Clone, RustcEncodable, RustcDecodable)]
1156+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
11571157
pub struct Trait {
11581158
pub unsafety: ast::Unsafety,
11591159
pub items: Vec<TraitMethod>,
@@ -1197,11 +1197,11 @@ impl Clean<PolyTrait> for ast::PolyTraitRef {
11971197

11981198
/// An item belonging to a trait, whether a method or associated. Could be named
11991199
/// TraitItem except that's already taken by an exported enum variant.
1200-
#[derive(Clone, RustcEncodable, RustcDecodable)]
1200+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
12011201
pub enum TraitMethod {
12021202
RequiredMethod(Item),
12031203
ProvidedMethod(Item),
1204-
TypeTraitItem(Item),
1204+
TypeTraitItem(Item), // an associated type
12051205
}
12061206

12071207
impl TraitMethod {
@@ -1242,7 +1242,7 @@ impl Clean<TraitMethod> for ast::TraitItem {
12421242
}
12431243
}
12441244

1245-
#[derive(Clone, RustcEncodable, RustcDecodable)]
1245+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
12461246
pub enum ImplMethod {
12471247
MethodImplItem(Item),
12481248
TypeImplItem(Item),
@@ -1378,7 +1378,7 @@ pub enum PrimitiveType {
13781378
PrimitiveTuple,
13791379
}
13801380

1381-
#[derive(Clone, RustcEncodable, RustcDecodable, Copy)]
1381+
#[derive(Clone, RustcEncodable, RustcDecodable, Copy, Show)]
13821382
pub enum TypeKind {
13831383
TypeEnum,
13841384
TypeFunction,
@@ -1621,7 +1621,7 @@ impl Clean<Type> for ast::QPath {
16211621
}
16221622
}
16231623

1624-
#[derive(Clone, RustcEncodable, RustcDecodable)]
1624+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
16251625
pub enum StructField {
16261626
HiddenStructField, // inserted later by strip passes
16271627
TypedStructField(Type),
@@ -1680,7 +1680,7 @@ impl Clean<Option<Visibility>> for ast::Visibility {
16801680
}
16811681
}
16821682

1683-
#[derive(Clone, RustcEncodable, RustcDecodable)]
1683+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
16841684
pub struct Struct {
16851685
pub struct_type: doctree::StructType,
16861686
pub generics: Generics,
@@ -1710,7 +1710,7 @@ impl Clean<Item> for doctree::Struct {
17101710
/// This is a more limited form of the standard Struct, different in that
17111711
/// it lacks the things most items have (name, id, parameterization). Found
17121712
/// only as a variant in an enum.
1713-
#[derive(Clone, RustcEncodable, RustcDecodable)]
1713+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
17141714
pub struct VariantStruct {
17151715
pub struct_type: doctree::StructType,
17161716
pub fields: Vec<Item>,
@@ -1727,7 +1727,7 @@ impl Clean<VariantStruct> for syntax::ast::StructDef {
17271727
}
17281728
}
17291729

1730-
#[derive(Clone, RustcEncodable, RustcDecodable)]
1730+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
17311731
pub struct Enum {
17321732
pub variants: Vec<Item>,
17331733
pub generics: Generics,
@@ -1752,7 +1752,7 @@ impl Clean<Item> for doctree::Enum {
17521752
}
17531753
}
17541754

1755-
#[derive(Clone, RustcEncodable, RustcDecodable)]
1755+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
17561756
pub struct Variant {
17571757
pub kind: VariantKind,
17581758
}
@@ -1820,7 +1820,7 @@ impl<'tcx> Clean<Item> for ty::VariantInfo<'tcx> {
18201820
}
18211821
}
18221822

1823-
#[derive(Clone, RustcEncodable, RustcDecodable)]
1823+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
18241824
pub enum VariantKind {
18251825
CLikeVariant,
18261826
TupleVariant(Vec<Type>),
@@ -1967,7 +1967,7 @@ impl Clean<String> for ast::Name {
19671967
}
19681968
}
19691969

1970-
#[derive(Clone, RustcEncodable, RustcDecodable)]
1970+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
19711971
pub struct Typedef {
19721972
pub type_: Type,
19731973
pub generics: Generics,
@@ -2080,7 +2080,7 @@ impl Clean<Mutability> for ast::Mutability {
20802080
}
20812081
}
20822082

2083-
#[derive(Clone, RustcEncodable, RustcDecodable)]
2083+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
20842084
pub struct Impl {
20852085
pub generics: Generics,
20862086
pub trait_: Option<Type>,
@@ -2118,7 +2118,7 @@ impl Clean<Item> for doctree::Impl {
21182118
}
21192119
}
21202120

2121-
#[derive(Clone, RustcEncodable, RustcDecodable)]
2121+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
21222122
pub struct ViewItem {
21232123
pub inner: ViewItemInner,
21242124
}
@@ -2184,7 +2184,7 @@ impl Clean<Vec<Item>> for ast::ViewItem {
21842184
}
21852185
}
21862186

2187-
#[derive(Clone, RustcEncodable, RustcDecodable)]
2187+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
21882188
pub enum ViewItemInner {
21892189
ExternCrate(String, Option<String>, ast::NodeId),
21902190
Import(ViewPath)
@@ -2207,7 +2207,7 @@ impl Clean<ViewItemInner> for ast::ViewItem_ {
22072207
}
22082208
}
22092209

2210-
#[derive(Clone, RustcEncodable, RustcDecodable)]
2210+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
22112211
pub enum ViewPath {
22122212
// use source as str;
22132213
SimpleImport(String, ImportSource),
@@ -2217,7 +2217,7 @@ pub enum ViewPath {
22172217
ImportList(ImportSource, Vec<ViewListIdent>),
22182218
}
22192219

2220-
#[derive(Clone, RustcEncodable, RustcDecodable)]
2220+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
22212221
pub struct ImportSource {
22222222
pub path: Path,
22232223
pub did: Option<ast::DefId>,
@@ -2238,7 +2238,7 @@ impl Clean<ViewPath> for ast::ViewPath {
22382238
}
22392239
}
22402240

2241-
#[derive(Clone, RustcEncodable, RustcDecodable)]
2241+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
22422242
pub struct ViewListIdent {
22432243
pub name: String,
22442244
pub source: Option<ast::DefId>,
@@ -2457,7 +2457,7 @@ fn resolve_def(cx: &DocContext, id: ast::NodeId) -> Option<ast::DefId> {
24572457
})
24582458
}
24592459

2460-
#[derive(Clone, RustcEncodable, RustcDecodable)]
2460+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
24612461
pub struct Macro {
24622462
pub source: String,
24632463
}
@@ -2478,7 +2478,7 @@ impl Clean<Item> for doctree::Macro {
24782478
}
24792479
}
24802480

2481-
#[derive(Clone, RustcEncodable, RustcDecodable)]
2481+
#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
24822482
pub struct Stability {
24832483
pub level: attr::StabilityLevel,
24842484
pub text: String

0 commit comments

Comments
 (0)