1
Fork 0

Remove unused attrs field from keywords

This commit is contained in:
Joshua Nelson 2020-11-23 22:40:36 -05:00
parent e3e8087309
commit 51f00b08eb
3 changed files with 17 additions and 23 deletions

View file

@ -177,7 +177,7 @@ impl Clean<ExternalCrate> for CrateNum {
}
}
}
return keyword.map(|p| (def_id, p, attrs));
return keyword.map(|p| (def_id, p));
}
None
};
@ -199,8 +199,8 @@ impl Clean<ExternalCrate> for CrateNum {
hir::ItemKind::Use(ref path, hir::UseKind::Single)
if item.vis.node.is_pub() =>
{
as_keyword(path.res).map(|(_, prim, attrs)| {
(cx.tcx.hir().local_def_id(id.id).to_def_id(), prim, attrs)
as_keyword(path.res).map(|(_, prim)| {
(cx.tcx.hir().local_def_id(id.id).to_def_id(), prim)
})
}
_ => None,

View file

@ -33,8 +33,8 @@ use smallvec::{smallvec, SmallVec};
use crate::clean::cfg::Cfg;
use crate::clean::external_path;
use crate::clean::inline;
use crate::clean::Clean;
use crate::clean::types::Type::{QPath, ResolvedPath};
use crate::clean::Clean;
use crate::core::DocContext;
use crate::doctree;
use crate::formats::cache::cache;
@ -69,7 +69,7 @@ crate struct ExternalCrate {
crate src: FileName,
crate attrs: Attributes,
crate primitives: Vec<(DefId, PrimitiveType)>,
crate keywords: Vec<(DefId, String, Attributes)>,
crate keywords: Vec<(DefId, String)>,
}
/// Anything with a source location and set of attributes and, optionally, a
@ -121,7 +121,12 @@ impl Item {
kind: ItemKind,
cx: &DocContext<'_>,
) -> Item {
Item::from_def_id_and_parts(cx.tcx.hir().local_def_id(hir_id).to_def_id(), name.clean(cx), kind, cx)
Item::from_def_id_and_parts(
cx.tcx.hir().local_def_id(hir_id).to_def_id(),
name.clean(cx),
kind,
cx,
)
}
pub fn from_def_id_and_parts(

View file

@ -1,10 +1,10 @@
use crate::clean::auto_trait::AutoTraitFinder;
use crate::clean::blanket_impl::BlanketImplFinder;
use crate::clean::{
inline, Clean, Crate, ExternalCrate, FnDecl, FnRetTy, Generic, GenericArg,
GenericArgs, GenericBound, Generics, GetDefId, ImportSource, Item, ItemKind, Lifetime,
MacroKind, Path, PathSegment, Primitive, PrimitiveType, ResolvedPath, Type, TypeBinding,
TypeKind, WherePredicate,
inline, Clean, Crate, ExternalCrate, FnDecl, FnRetTy, Generic, GenericArg, GenericArgs,
GenericBound, Generics, GetDefId, ImportSource, Item, ItemKind, Lifetime, MacroKind, Path,
PathSegment, Primitive, PrimitiveType, ResolvedPath, Type, TypeBinding, TypeKind,
WherePredicate,
};
use crate::core::DocContext;
@ -73,20 +73,9 @@ crate fn krate(mut cx: &mut DocContext<'_>) -> Crate {
cx,
)
}));
m.items.extend(keywords.into_iter()
.map(|(def_id, kw, _)| Item::from_def_id_and_parts(def_id, Some(kw.clone()), ItemKind::KeywordItem(kw), cx)
));
/*
source: Span::empty(),
name: Some(kw.clone()),
attrs,
visibility: Visibility::Public,
stability: get_stability(cx, def_id),
deprecation: get_deprecation(cx, def_id),
def_id,
kind: ItemKind::KeywordItem(kw),
m.items.extend(keywords.into_iter().map(|(def_id, kw)| {
Item::from_def_id_and_parts(def_id, Some(kw.clone()), ItemKind::KeywordItem(kw), cx)
}));
*/
}
Crate {