Remove Ty prefix from Ty{Bool|Char|Int|Uint|Float|Str}

This commit is contained in:
varkor 2018-08-22 01:35:55 +01:00
parent 04fa5d3adb
commit 8a5dccde2a
64 changed files with 546 additions and 546 deletions

View file

@ -25,19 +25,19 @@ where F: Fn(& dyn Fn(DefId) -> Def) -> Vec<Item> {
AdtKind::Enum => Def::Enum,
AdtKind::Union => Def::Union,
}),
ty::TyInt(_) |
ty::TyUint(_) |
ty::TyFloat(_) |
ty::TyStr |
ty::TyBool |
ty::TyChar => callback(&move |_: DefId| {
ty::Int(_) |
ty::Uint(_) |
ty::Float(_) |
ty::Str |
ty::Bool |
ty::Char => callback(&move |_: DefId| {
match ty.sty {
ty::TyInt(x) => Def::PrimTy(hir::TyInt(x)),
ty::TyUint(x) => Def::PrimTy(hir::TyUint(x)),
ty::TyFloat(x) => Def::PrimTy(hir::TyFloat(x)),
ty::TyStr => Def::PrimTy(hir::TyStr),
ty::TyBool => Def::PrimTy(hir::TyBool),
ty::TyChar => Def::PrimTy(hir::TyChar),
ty::Int(x) => Def::PrimTy(hir::Int(x)),
ty::Uint(x) => Def::PrimTy(hir::Uint(x)),
ty::Float(x) => Def::PrimTy(hir::Float(x)),
ty::Str => Def::PrimTy(hir::Str),
ty::Bool => Def::PrimTy(hir::Bool),
ty::Char => Def::PrimTy(hir::Char),
_ => unreachable!(),
}
}),

View file

@ -2546,12 +2546,12 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
fn clean(&self, cx: &DocContext) -> Type {
match self.sty {
ty::Never => Never,
ty::TyBool => Primitive(PrimitiveType::Bool),
ty::TyChar => Primitive(PrimitiveType::Char),
ty::TyInt(int_ty) => Primitive(int_ty.into()),
ty::TyUint(uint_ty) => Primitive(uint_ty.into()),
ty::TyFloat(float_ty) => Primitive(float_ty.into()),
ty::TyStr => Primitive(PrimitiveType::Str),
ty::Bool => Primitive(PrimitiveType::Bool),
ty::Char => Primitive(PrimitiveType::Char),
ty::Int(int_ty) => Primitive(int_ty.into()),
ty::Uint(uint_ty) => Primitive(uint_ty.into()),
ty::Float(float_ty) => Primitive(float_ty.into()),
ty::Str => Primitive(PrimitiveType::Str),
ty::Slice(ty) => Slice(box ty.clean(cx)),
ty::Array(ty, n) => {
let mut n = cx.tcx.lift(&n).expect("array lift failed");
@ -3700,12 +3700,12 @@ fn resolve_type(cx: &DocContext,
let is_generic = match path.def {
Def::PrimTy(p) => match p {
hir::TyStr => return Primitive(PrimitiveType::Str),
hir::TyBool => return Primitive(PrimitiveType::Bool),
hir::TyChar => return Primitive(PrimitiveType::Char),
hir::TyInt(int_ty) => return Primitive(int_ty.into()),
hir::TyUint(uint_ty) => return Primitive(uint_ty.into()),
hir::TyFloat(float_ty) => return Primitive(float_ty.into()),
hir::Str => return Primitive(PrimitiveType::Str),
hir::Bool => return Primitive(PrimitiveType::Bool),
hir::Char => return Primitive(PrimitiveType::Char),
hir::Int(int_ty) => return Primitive(int_ty.into()),
hir::Uint(uint_ty) => return Primitive(uint_ty.into()),
hir::Float(float_ty) => return Primitive(float_ty.into()),
},
Def::SelfTy(..) if path.segments.len() == 1 => {
return Generic(keywords::SelfType.name().to_string());

View file

@ -567,23 +567,23 @@ fn handle_variant(cx: &DocContext, def: Def) -> Result<(Def, Option<String>), ()
}
const PRIMITIVES: &[(&str, Def)] = &[
("u8", Def::PrimTy(hir::PrimTy::TyUint(syntax::ast::UintTy::U8))),
("u16", Def::PrimTy(hir::PrimTy::TyUint(syntax::ast::UintTy::U16))),
("u32", Def::PrimTy(hir::PrimTy::TyUint(syntax::ast::UintTy::U32))),
("u64", Def::PrimTy(hir::PrimTy::TyUint(syntax::ast::UintTy::U64))),
("u128", Def::PrimTy(hir::PrimTy::TyUint(syntax::ast::UintTy::U128))),
("usize", Def::PrimTy(hir::PrimTy::TyUint(syntax::ast::UintTy::Usize))),
("i8", Def::PrimTy(hir::PrimTy::TyInt(syntax::ast::IntTy::I8))),
("i16", Def::PrimTy(hir::PrimTy::TyInt(syntax::ast::IntTy::I16))),
("i32", Def::PrimTy(hir::PrimTy::TyInt(syntax::ast::IntTy::I32))),
("i64", Def::PrimTy(hir::PrimTy::TyInt(syntax::ast::IntTy::I64))),
("i128", Def::PrimTy(hir::PrimTy::TyInt(syntax::ast::IntTy::I128))),
("isize", Def::PrimTy(hir::PrimTy::TyInt(syntax::ast::IntTy::Isize))),
("f32", Def::PrimTy(hir::PrimTy::TyFloat(syntax::ast::FloatTy::F32))),
("f64", Def::PrimTy(hir::PrimTy::TyFloat(syntax::ast::FloatTy::F64))),
("str", Def::PrimTy(hir::PrimTy::TyStr)),
("bool", Def::PrimTy(hir::PrimTy::TyBool)),
("char", Def::PrimTy(hir::PrimTy::TyChar)),
("u8", Def::PrimTy(hir::PrimTy::Uint(syntax::ast::UintTy::U8))),
("u16", Def::PrimTy(hir::PrimTy::Uint(syntax::ast::UintTy::U16))),
("u32", Def::PrimTy(hir::PrimTy::Uint(syntax::ast::UintTy::U32))),
("u64", Def::PrimTy(hir::PrimTy::Uint(syntax::ast::UintTy::U64))),
("u128", Def::PrimTy(hir::PrimTy::Uint(syntax::ast::UintTy::U128))),
("usize", Def::PrimTy(hir::PrimTy::Uint(syntax::ast::UintTy::Usize))),
("i8", Def::PrimTy(hir::PrimTy::Int(syntax::ast::IntTy::I8))),
("i16", Def::PrimTy(hir::PrimTy::Int(syntax::ast::IntTy::I16))),
("i32", Def::PrimTy(hir::PrimTy::Int(syntax::ast::IntTy::I32))),
("i64", Def::PrimTy(hir::PrimTy::Int(syntax::ast::IntTy::I64))),
("i128", Def::PrimTy(hir::PrimTy::Int(syntax::ast::IntTy::I128))),
("isize", Def::PrimTy(hir::PrimTy::Int(syntax::ast::IntTy::Isize))),
("f32", Def::PrimTy(hir::PrimTy::Float(syntax::ast::FloatTy::F32))),
("f64", Def::PrimTy(hir::PrimTy::Float(syntax::ast::FloatTy::F64))),
("str", Def::PrimTy(hir::PrimTy::Str)),
("bool", Def::PrimTy(hir::PrimTy::Bool)),
("char", Def::PrimTy(hir::PrimTy::Char)),
];
fn is_primitive(path_str: &str, is_val: bool) -> Option<Def> {