Simplified checking for non_exhaustive attribute.
This commit is contained in:
parent
3e59aef385
commit
5ccafa106f
7 changed files with 8 additions and 41 deletions
|
|
@ -229,7 +229,6 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
|
|||
def_id: self.next_def_id(def_id.krate),
|
||||
stability: None,
|
||||
deprecation: None,
|
||||
non_exhaustive: false,
|
||||
inner: ImplItem(Impl {
|
||||
unsafety: hir::Unsafety::Normal,
|
||||
generics: new_generics,
|
||||
|
|
|
|||
|
|
@ -111,7 +111,6 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa
|
|||
visibility: Some(clean::Public),
|
||||
stability: cx.tcx.lookup_stability(did).clean(cx),
|
||||
deprecation: cx.tcx.lookup_deprecation(did).clean(cx),
|
||||
non_exhaustive: false,
|
||||
def_id: did,
|
||||
});
|
||||
Some(ret)
|
||||
|
|
@ -413,7 +412,6 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec<clean::Item>) {
|
|||
visibility: Some(clean::Inherited),
|
||||
stability: tcx.lookup_stability(did).clean(cx),
|
||||
deprecation: tcx.lookup_deprecation(did).clean(cx),
|
||||
non_exhaustive: false,
|
||||
def_id: did,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,7 +192,6 @@ impl<'a, 'tcx, 'rcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx, 'rcx>
|
|||
visibility: Some(Public),
|
||||
stability: get_stability(cx, def_id),
|
||||
deprecation: get_deprecation(cx, def_id),
|
||||
non_exhaustive: false,
|
||||
def_id,
|
||||
inner: PrimitiveItem(prim),
|
||||
}
|
||||
|
|
@ -205,7 +204,6 @@ impl<'a, 'tcx, 'rcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx, 'rcx>
|
|||
visibility: Some(Public),
|
||||
stability: get_stability(cx, def_id),
|
||||
deprecation: get_deprecation(cx, def_id),
|
||||
non_exhaustive: false,
|
||||
def_id,
|
||||
inner: KeywordItem(kw),
|
||||
}
|
||||
|
|
@ -368,7 +366,6 @@ pub struct Item {
|
|||
pub def_id: DefId,
|
||||
pub stability: Option<Stability>,
|
||||
pub deprecation: Option<Deprecation>,
|
||||
pub non_exhaustive: bool,
|
||||
}
|
||||
|
||||
impl fmt::Debug for Item {
|
||||
|
|
@ -498,6 +495,12 @@ impl Item {
|
|||
self.stability.as_ref().map(|s| &s.since[..])
|
||||
}
|
||||
|
||||
pub fn is_non_exhaustive(&self) -> bool {
|
||||
self.attrs.other_attrs.iter()
|
||||
.filter(|a| a.name().as_str() == "non_exhaustive")
|
||||
.count() > 0
|
||||
}
|
||||
|
||||
/// Returns a documentation-level item type from the item.
|
||||
pub fn type_(&self) -> ItemType {
|
||||
ItemType::from(self)
|
||||
|
|
@ -628,7 +631,6 @@ impl Clean<Item> for doctree::Module {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
non_exhaustive: false,
|
||||
def_id: cx.tcx.hir.local_def_id(self.id),
|
||||
inner: ModuleItem(Module {
|
||||
is_crate: self.is_crate,
|
||||
|
|
@ -2121,7 +2123,6 @@ impl Clean<Item> for doctree::Function {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
non_exhaustive: false,
|
||||
def_id: cx.tcx.hir.local_def_id(self.id),
|
||||
inner: FunctionItem(Function {
|
||||
decl,
|
||||
|
|
@ -2303,7 +2304,6 @@ impl Clean<Item> for doctree::Trait {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
non_exhaustive: false,
|
||||
inner: TraitItem(Trait {
|
||||
auto: self.is_auto.clean(cx),
|
||||
unsafety: self.unsafety,
|
||||
|
|
@ -2373,7 +2373,6 @@ impl Clean<Item> for hir::TraitItem {
|
|||
visibility: None,
|
||||
stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)),
|
||||
deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)),
|
||||
non_exhaustive: false,
|
||||
inner,
|
||||
}
|
||||
}
|
||||
|
|
@ -2402,7 +2401,6 @@ impl Clean<Item> for hir::ImplItem {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)),
|
||||
deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)),
|
||||
non_exhaustive: false,
|
||||
inner,
|
||||
}
|
||||
}
|
||||
|
|
@ -2549,7 +2547,6 @@ impl<'tcx> Clean<Item> for ty::AssociatedItem {
|
|||
visibility,
|
||||
stability: get_stability(cx, self.def_id),
|
||||
deprecation: get_deprecation(cx, self.def_id),
|
||||
non_exhaustive: false,
|
||||
def_id: self.def_id,
|
||||
attrs: inline::load_attrs(cx, self.def_id),
|
||||
source: cx.tcx.def_span(self.def_id).clean(cx),
|
||||
|
|
@ -3203,7 +3200,6 @@ impl Clean<Item> for hir::StructField {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)),
|
||||
deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)),
|
||||
non_exhaustive: false,
|
||||
def_id: cx.tcx.hir.local_def_id(self.id),
|
||||
inner: StructFieldItem(self.ty.clean(cx)),
|
||||
}
|
||||
|
|
@ -3219,7 +3215,6 @@ impl<'tcx> Clean<Item> for ty::FieldDef {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: get_stability(cx, self.did),
|
||||
deprecation: get_deprecation(cx, self.did),
|
||||
non_exhaustive: false,
|
||||
def_id: self.did,
|
||||
inner: StructFieldItem(cx.tcx.type_of(self.did).clean(cx)),
|
||||
}
|
||||
|
|
@ -3284,7 +3279,6 @@ impl Clean<Vec<Item>> for doctree::Struct {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
non_exhaustive: self.non_exhaustive,
|
||||
inner: StructItem(Struct {
|
||||
struct_type: self.struct_type,
|
||||
generics: self.generics.clean(cx),
|
||||
|
|
@ -3310,7 +3304,6 @@ impl Clean<Vec<Item>> for doctree::Union {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
non_exhaustive: false,
|
||||
inner: UnionItem(Union {
|
||||
struct_type: self.struct_type,
|
||||
generics: self.generics.clean(cx),
|
||||
|
|
@ -3363,7 +3356,6 @@ impl Clean<Vec<Item>> for doctree::Enum {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
non_exhaustive: self.non_exhaustive,
|
||||
inner: EnumItem(Enum {
|
||||
variants: self.variants.clean(cx),
|
||||
generics: self.generics.clean(cx),
|
||||
|
|
@ -3389,7 +3381,6 @@ impl Clean<Item> for doctree::Variant {
|
|||
visibility: None,
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
non_exhaustive: false,
|
||||
def_id: cx.tcx.hir.local_def_id(self.def.id()),
|
||||
inner: VariantItem(Variant {
|
||||
kind: self.def.clean(cx),
|
||||
|
|
@ -3420,7 +3411,6 @@ impl<'tcx> Clean<Item> for ty::VariantDef {
|
|||
def_id: field.did,
|
||||
stability: get_stability(cx, field.did),
|
||||
deprecation: get_deprecation(cx, field.did),
|
||||
non_exhaustive: false,
|
||||
inner: StructFieldItem(cx.tcx.type_of(field.did).clean(cx))
|
||||
}
|
||||
}).collect()
|
||||
|
|
@ -3436,7 +3426,6 @@ impl<'tcx> Clean<Item> for ty::VariantDef {
|
|||
inner: VariantItem(Variant { kind: kind }),
|
||||
stability: get_stability(cx, self.did),
|
||||
deprecation: get_deprecation(cx, self.did),
|
||||
non_exhaustive: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3688,7 +3677,6 @@ impl Clean<Item> for doctree::Typedef {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
non_exhaustive: false,
|
||||
inner: TypedefItem(Typedef {
|
||||
type_: self.ty.clean(cx),
|
||||
generics: self.gen.clean(cx),
|
||||
|
|
@ -3740,7 +3728,6 @@ impl Clean<Item> for doctree::Static {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
non_exhaustive: false,
|
||||
inner: StaticItem(Static {
|
||||
type_: self.type_.clean(cx),
|
||||
mutability: self.mutability.clean(cx),
|
||||
|
|
@ -3766,7 +3753,6 @@ impl Clean<Item> for doctree::Constant {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
non_exhaustive: false,
|
||||
inner: ConstantItem(Constant {
|
||||
type_: self.type_.clean(cx),
|
||||
expr: print_const_expr(cx, self.expr),
|
||||
|
|
@ -3855,7 +3841,6 @@ impl Clean<Vec<Item>> for doctree::Impl {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
non_exhaustive: false,
|
||||
inner: ImplItem(Impl {
|
||||
unsafety: self.unsafety,
|
||||
generics: self.generics.clean(cx),
|
||||
|
|
@ -3942,7 +3927,6 @@ impl Clean<Item> for doctree::ExternCrate {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: None,
|
||||
deprecation: None,
|
||||
non_exhaustive: false,
|
||||
inner: ExternCrateItem(self.name.clean(cx), self.path.clone())
|
||||
}
|
||||
}
|
||||
|
|
@ -3989,7 +3973,6 @@ impl Clean<Vec<Item>> for doctree::Import {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: None,
|
||||
deprecation: None,
|
||||
non_exhaustive: false,
|
||||
inner: ImportItem(inner)
|
||||
}]
|
||||
}
|
||||
|
|
@ -4058,7 +4041,6 @@ impl Clean<Item> for hir::ForeignItem {
|
|||
visibility: self.vis.clean(cx),
|
||||
stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)),
|
||||
deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)),
|
||||
non_exhaustive: false,
|
||||
inner,
|
||||
}
|
||||
}
|
||||
|
|
@ -4233,7 +4215,6 @@ impl Clean<Item> for doctree::Macro {
|
|||
visibility: Some(Public),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
non_exhaustive: false,
|
||||
def_id: self.def_id,
|
||||
inner: MacroItem(Macro {
|
||||
source: format!("macro_rules! {} {{\n{}}}",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue