remove unused derives and variants

This commit is contained in:
Andy Russell 2019-06-26 21:15:13 -04:00
parent d3e2cec292
commit e991abd004
No known key found for this signature in database
GPG Key ID: BE2221033EDBC374
7 changed files with 56 additions and 68 deletions

View File

@ -16,7 +16,7 @@ use syntax_pos::Span;
use crate::html::escape::Escape;
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, PartialEq, Eq, Hash)]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum Cfg {
/// Accepts all configurations.
True,

View File

@ -223,7 +223,7 @@ impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct ExternalCrate {
pub name: String,
pub src: FileName,
@ -355,7 +355,7 @@ impl Clean<ExternalCrate> for CrateNum {
/// Anything with a source location and set of attributes and, optionally, a
/// name. That is, anything that can be documented. This doesn't correspond
/// directly to the AST's concept of an item; it's a strict superset.
#[derive(Clone, RustcEncodable, RustcDecodable)]
#[derive(Clone)]
pub struct Item {
/// Stringified span
pub source: Span,
@ -528,7 +528,7 @@ impl Item {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub enum ItemEnum {
ExternCrateItem(String, Option<String>),
ImportItem(Import),
@ -594,7 +594,7 @@ impl ItemEnum {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Module {
pub items: Vec<Item>,
pub is_crate: bool,
@ -731,7 +731,7 @@ impl<I: IntoIterator<Item=ast::NestedMetaItem>> NestedAttributesExt for I {
/// Included files are kept separate from inline doc comments so that proper line-number
/// information can be given when a doctest fails. Sugared doc comments and "raw" doc comments are
/// kept separate because of issue #42760.
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum DocFragment {
/// A doc fragment created from a `///` or `//!` doc comment.
SugaredDoc(usize, syntax_pos::Span, String),
@ -781,7 +781,7 @@ impl<'a> FromIterator<&'a DocFragment> for String {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Default)]
#[derive(Clone, Debug, Default)]
pub struct Attributes {
pub doc_strings: Vec<DocFragment>,
pub other_attrs: Vec<ast::Attribute>,
@ -1048,7 +1048,7 @@ impl Clean<Attributes> for [ast::Attribute] {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum GenericBound {
TraitBound(PolyTrait, hir::TraitBoundModifier),
Outlives(Lifetime),
@ -1231,7 +1231,7 @@ impl<'tcx> Clean<Option<Vec<GenericBound>>> for InternalSubsts<'tcx> {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub struct Lifetime(String);
impl Lifetime {
@ -1326,7 +1326,7 @@ impl Clean<Option<Lifetime>> for ty::RegionKind {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum WherePredicate {
BoundPredicate { ty: Type, bounds: Vec<GenericBound> },
RegionPredicate { lifetime: Lifetime, bounds: Vec<GenericBound> },
@ -1464,7 +1464,7 @@ impl<'tcx> Clean<Type> for ty::ProjectionTy<'tcx> {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum GenericParamDefKind {
Lifetime,
Type {
@ -1498,7 +1498,7 @@ impl GenericParamDefKind {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub struct GenericParamDef {
pub name: String,
@ -1610,7 +1610,7 @@ impl Clean<GenericParamDef> for hir::GenericParam {
}
// maybe use a Generic enum and use Vec<Generic>?
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Default, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Default, Hash)]
pub struct Generics {
pub params: Vec<GenericParamDef>,
pub where_predicates: Vec<WherePredicate>,
@ -1874,7 +1874,7 @@ pub fn get_all_types(
(all_types.into_iter().collect(), ret_types)
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Method {
pub generics: Generics,
pub decl: FnDecl,
@ -1902,7 +1902,7 @@ impl<'a> Clean<Method> for (&'a hir::MethodSig, &'a hir::Generics, hir::BodyId,
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct TyMethod {
pub header: hir::FnHeader,
pub decl: FnDecl,
@ -1911,7 +1911,7 @@ pub struct TyMethod {
pub ret_types: Vec<Type>,
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Function {
pub decl: FnDecl,
pub generics: Generics,
@ -1952,7 +1952,7 @@ impl Clean<Item> for doctree::Function<'_> {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub struct FnDecl {
pub inputs: Arguments,
pub output: FunctionRetTy,
@ -1989,7 +1989,7 @@ impl FnDecl {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub struct Arguments {
pub values: Vec<Argument>,
}
@ -2063,13 +2063,13 @@ impl<'tcx> Clean<FnDecl> for (DefId, ty::PolyFnSig<'tcx>) {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub struct Argument {
pub type_: Type,
pub name: String,
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)]
#[derive(Clone, PartialEq, Debug)]
pub enum SelfTy {
SelfValue,
SelfBorrowed(Option<Lifetime>, Mutability),
@ -2093,7 +2093,7 @@ impl Argument {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum FunctionRetTy {
Return(Type),
DefaultReturn,
@ -2117,7 +2117,7 @@ impl GetDefId for FunctionRetTy {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Trait {
pub auto: bool,
pub unsafety: hir::Unsafety,
@ -2153,7 +2153,7 @@ impl Clean<Item> for doctree::Trait<'_> {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct TraitAlias {
pub generics: Generics,
pub bounds: Vec<GenericBound>,
@ -2437,7 +2437,7 @@ impl Clean<Item> for ty::AssocItem {
}
/// A trait reference, which may have higher ranked lifetimes.
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub struct PolyTrait {
pub trait_: Type,
pub generic_params: Vec<GenericParamDef>,
@ -2446,7 +2446,7 @@ pub struct PolyTrait {
/// A representation of a type suitable for hyperlinking purposes. Ideally, one can get the original
/// type out of the AST/`TyCtxt` given one of these, if more information is needed. Most
/// importantly, it does not preserve mutability or boxes.
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum Type {
/// Structs/enums/traits (most that would be an `hir::TyKind::Path`).
ResolvedPath {
@ -2469,7 +2469,6 @@ pub enum Type {
Array(Box<Type>, String),
Never,
CVarArgs,
Unique(Box<Type>),
RawPointer(Mutability, Box<Type>),
BorrowedRef {
lifetime: Option<Lifetime>,
@ -2491,7 +2490,7 @@ pub enum Type {
ImplTrait(Vec<GenericBound>),
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Copy, Debug)]
#[derive(Clone, PartialEq, Eq, Hash, Copy, Debug)]
pub enum PrimitiveType {
Isize, I8, I16, I32, I64, I128,
Usize, U8, U16, U32, U64, U128,
@ -2510,7 +2509,7 @@ pub enum PrimitiveType {
CVarArgs,
}
#[derive(Clone, RustcEncodable, RustcDecodable, Copy, Debug)]
#[derive(Clone, Copy, Debug)]
pub enum TypeKind {
Enum,
Function,
@ -2520,7 +2519,6 @@ pub enum TypeKind {
Struct,
Union,
Trait,
Variant,
Typedef,
Foreign,
Macro,
@ -3190,7 +3188,7 @@ impl Clean<Item> for ty::FieldDef {
}
}
#[derive(Clone, PartialEq, Eq, RustcDecodable, RustcEncodable, Debug)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum Visibility {
Public,
Inherited,
@ -3219,7 +3217,7 @@ impl Clean<Option<Visibility>> for ty::Visibility {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Struct {
pub struct_type: doctree::StructType,
pub generics: Generics,
@ -3227,7 +3225,7 @@ pub struct Struct {
pub fields_stripped: bool,
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Union {
pub struct_type: doctree::StructType,
pub generics: Generics,
@ -3278,7 +3276,7 @@ impl Clean<Item> for doctree::Union<'_> {
/// This is a more limited form of the standard Struct, different in that
/// it lacks the things most items have (name, id, parameterization). Found
/// only as a variant in an enum.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct VariantStruct {
pub struct_type: doctree::StructType,
pub fields: Vec<Item>,
@ -3295,7 +3293,7 @@ impl Clean<VariantStruct> for ::rustc::hir::VariantData {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Enum {
pub variants: IndexVec<VariantIdx, Item>,
pub generics: Generics,
@ -3321,7 +3319,7 @@ impl Clean<Item> for doctree::Enum<'_> {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Variant {
pub kind: VariantKind,
}
@ -3384,7 +3382,7 @@ impl Clean<Item> for ty::VariantDef {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub enum VariantKind {
CLike,
Tuple(Vec<Type>),
@ -3402,7 +3400,7 @@ impl Clean<VariantKind> for hir::VariantData {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Span {
pub filename: FileName,
pub loline: usize,
@ -3448,7 +3446,7 @@ impl Clean<Span> for syntax_pos::Span {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub struct Path {
pub global: bool,
pub res: Res,
@ -3471,7 +3469,7 @@ impl Clean<Path> for hir::Path {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum GenericArg {
Lifetime(Lifetime),
Type(Type),
@ -3488,7 +3486,7 @@ impl fmt::Display for GenericArg {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum GenericArgs {
AngleBracketed {
args: Vec<GenericArg>,
@ -3528,7 +3526,7 @@ impl Clean<GenericArgs> for hir::GenericArgs {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub struct PathSegment {
pub name: String,
pub args: GenericArgs,
@ -3553,7 +3551,6 @@ fn strip_type(ty: Type) -> Type {
}
Type::Slice(inner_ty) => Type::Slice(Box::new(strip_type(*inner_ty))),
Type::Array(inner_ty, s) => Type::Array(Box::new(strip_type(*inner_ty)), s),
Type::Unique(inner_ty) => Type::Unique(Box::new(strip_type(*inner_ty))),
Type::RawPointer(m, inner_ty) => Type::RawPointer(m, Box::new(strip_type(*inner_ty))),
Type::BorrowedRef { lifetime, mutability, type_ } => {
Type::BorrowedRef { lifetime, mutability, type_: Box::new(strip_type(*type_)) }
@ -3625,7 +3622,7 @@ impl Clean<String> for InternedString {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Typedef {
pub type_: Type,
pub generics: Generics,
@ -3649,7 +3646,7 @@ impl Clean<Item> for doctree::Typedef<'_> {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Existential {
pub bounds: Vec<GenericBound>,
pub generics: Generics,
@ -3673,7 +3670,7 @@ impl Clean<Item> for doctree::Existential<'_> {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub struct BareFunctionDecl {
pub unsafety: hir::Unsafety,
pub generic_params: Vec<GenericParamDef>,
@ -3695,7 +3692,7 @@ impl Clean<BareFunctionDecl> for hir::BareFnTy {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Static {
pub type_: Type,
pub mutability: Mutability,
@ -3725,7 +3722,7 @@ impl Clean<Item> for doctree::Static<'_> {
}
}
#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct Constant {
pub type_: Type,
pub expr: String,
@ -3749,7 +3746,7 @@ impl Clean<Item> for doctree::Constant<'_> {
}
}
#[derive(Debug, Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Copy, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Copy, Hash)]
pub enum Mutability {
Mutable,
Immutable,
@ -3764,7 +3761,7 @@ impl Clean<Mutability> for hir::Mutability {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Copy, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Copy, Debug, Hash)]
pub enum ImplPolarity {
Positive,
Negative,
@ -3779,7 +3776,7 @@ impl Clean<ImplPolarity> for hir::ImplPolarity {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Impl {
pub unsafety: hir::Unsafety,
pub generics: Generics,
@ -4003,7 +4000,7 @@ impl Clean<Vec<Item>> for doctree::Import<'_> {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub enum Import {
// use source as str;
Simple(String, ImportSource),
@ -4011,7 +4008,7 @@ pub enum Import {
Glob(ImportSource)
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct ImportSource {
pub path: Path,
pub did: Option<DefId>,
@ -4227,7 +4224,7 @@ fn resolve_use_source(cx: &DocContext<'_>, path: Path) -> ImportSource {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Macro {
pub source: String,
pub imported_from: Option<String>,
@ -4256,7 +4253,7 @@ impl Clean<Item> for doctree::Macro<'_> {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct ProcMacro {
pub kind: MacroKind,
pub helpers: Vec<String>,
@ -4280,7 +4277,7 @@ impl Clean<Item> for doctree::ProcMacro<'_> {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Stability {
pub level: stability::StabilityLevel,
pub feature: Option<String>,
@ -4290,7 +4287,7 @@ pub struct Stability {
pub issue: Option<u32>,
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Debug)]
pub struct Deprecation {
pub since: Option<String>,
pub note: Option<String>,
@ -4340,13 +4337,13 @@ impl Clean<Deprecation> for attr::Deprecation {
/// An type binding on an associated type (e.g., `A = Bar` in `Foo<A = Bar>` or
/// `A: Send + Sync` in `Foo<A: Send + Sync>`).
#[derive(Clone, PartialEq, Eq, RustcDecodable, RustcEncodable, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub struct TypeBinding {
pub name: String,
pub kind: TypeBindingKind,
}
#[derive(Clone, PartialEq, Eq, RustcDecodable, RustcEncodable, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum TypeBindingKind {
Equality {
ty: Type,

View File

@ -78,7 +78,7 @@ impl Module<'hir> {
}
}
#[derive(Debug, Clone, RustcEncodable, RustcDecodable, Copy)]
#[derive(Debug, Clone, Copy)]
pub enum StructType {
/// A braced struct
Plain,

View File

@ -737,9 +737,6 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter<'_>, use_absolute: bool) ->
}
}
}
clean::Unique(..) => {
panic!("should have been cleaned")
}
}
}

View File

@ -110,7 +110,6 @@ impl From<clean::TypeKind> for ItemType {
clean::TypeKind::Module => ItemType::Module,
clean::TypeKind::Static => ItemType::Static,
clean::TypeKind::Const => ItemType::Constant,
clean::TypeKind::Variant => ItemType::Variant,
clean::TypeKind::Typedef => ItemType::Typedef,
clean::TypeKind::Foreign => ItemType::ForeignType,
clean::TypeKind::Macro => ItemType::Macro,

View File

@ -5188,9 +5188,6 @@ fn collect_paths_for_type(first_ty: clean::Type) -> Vec<String> {
clean::Type::Array(ty, _) => {
work.push_back(*ty);
},
clean::Type::Unique(ty) => {
work.push_back(*ty);
},
clean::Type::RawPointer(_, ty) => {
work.push_back(*ty);
},

View File

@ -42,8 +42,6 @@ extern crate test as testing;
#[macro_use] extern crate log;
extern crate rustc_errors as errors;
extern crate serialize as rustc_serialize; // used by deriving
use std::default::Default;
use std::env;
use std::panic;