Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
c3bc905e
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c3bc905e
编写于
10月 01, 2016
作者:
C
Corey Farwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove redundant 'Type' in variant names, stop reexporting.
上级
8991ffc3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
48 deletion
+47
-48
src/librustdoc/clean/inline.rs
src/librustdoc/clean/inline.rs
+9
-9
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+28
-29
src/librustdoc/html/item_type.rs
src/librustdoc/html/item_type.rs
+10
-10
未找到文件。
src/librustdoc/clean/inline.rs
浏览文件 @
c3bc905e
...
...
@@ -73,33 +73,33 @@ fn try_inline_def<'a, 'tcx>(cx: &DocContext, tcx: TyCtxt<'a, 'tcx, 'tcx>,
let
did
=
def
.def_id
();
let
inner
=
match
def
{
Def
::
Trait
(
did
)
=>
{
record_extern_fqn
(
cx
,
did
,
clean
::
TypeTrait
);
record_extern_fqn
(
cx
,
did
,
clean
::
Type
Kind
::
Trait
);
ret
.extend
(
build_impls
(
cx
,
tcx
,
did
));
clean
::
TraitItem
(
build_external_trait
(
cx
,
tcx
,
did
))
}
Def
::
Fn
(
did
)
=>
{
record_extern_fqn
(
cx
,
did
,
clean
::
TypeFunction
);
record_extern_fqn
(
cx
,
did
,
clean
::
Type
Kind
::
Function
);
clean
::
FunctionItem
(
build_external_function
(
cx
,
tcx
,
did
))
}
Def
::
Struct
(
did
)
// If this is a struct constructor, we skip it
if
tcx
.def_key
(
did
)
.disambiguated_data.data
!=
DefPathData
::
StructCtor
=>
{
record_extern_fqn
(
cx
,
did
,
clean
::
TypeStruct
);
record_extern_fqn
(
cx
,
did
,
clean
::
Type
Kind
::
Struct
);
ret
.extend
(
build_impls
(
cx
,
tcx
,
did
));
clean
::
StructItem
(
build_struct
(
cx
,
tcx
,
did
))
}
Def
::
Union
(
did
)
=>
{
record_extern_fqn
(
cx
,
did
,
clean
::
TypeUnion
);
record_extern_fqn
(
cx
,
did
,
clean
::
Type
Kind
::
Union
);
ret
.extend
(
build_impls
(
cx
,
tcx
,
did
));
clean
::
UnionItem
(
build_union
(
cx
,
tcx
,
did
))
}
Def
::
TyAlias
(
did
)
=>
{
record_extern_fqn
(
cx
,
did
,
clean
::
TypeTypedef
);
record_extern_fqn
(
cx
,
did
,
clean
::
Type
Kind
::
Typedef
);
ret
.extend
(
build_impls
(
cx
,
tcx
,
did
));
clean
::
TypedefItem
(
build_type_alias
(
cx
,
tcx
,
did
),
false
)
}
Def
::
Enum
(
did
)
=>
{
record_extern_fqn
(
cx
,
did
,
clean
::
TypeEnum
);
record_extern_fqn
(
cx
,
did
,
clean
::
Type
Kind
::
Enum
);
ret
.extend
(
build_impls
(
cx
,
tcx
,
did
));
clean
::
EnumItem
(
build_enum
(
cx
,
tcx
,
did
))
}
...
...
@@ -107,15 +107,15 @@ fn try_inline_def<'a, 'tcx>(cx: &DocContext, tcx: TyCtxt<'a, 'tcx, 'tcx>,
// variants don't show up in documentation specially.
Def
::
Variant
(
..
)
=>
return
Some
(
Vec
::
new
()),
Def
::
Mod
(
did
)
=>
{
record_extern_fqn
(
cx
,
did
,
clean
::
TypeModule
);
record_extern_fqn
(
cx
,
did
,
clean
::
Type
Kind
::
Module
);
clean
::
ModuleItem
(
build_module
(
cx
,
tcx
,
did
))
}
Def
::
Static
(
did
,
mtbl
)
=>
{
record_extern_fqn
(
cx
,
did
,
clean
::
TypeStatic
);
record_extern_fqn
(
cx
,
did
,
clean
::
Type
Kind
::
Static
);
clean
::
StaticItem
(
build_static
(
cx
,
tcx
,
did
,
mtbl
))
}
Def
::
Const
(
did
)
|
Def
::
AssociatedConst
(
did
)
=>
{
record_extern_fqn
(
cx
,
did
,
clean
::
TypeConst
);
record_extern_fqn
(
cx
,
did
,
clean
::
Type
Kind
::
Const
);
clean
::
ConstantItem
(
build_const
(
cx
,
tcx
,
did
))
}
_
=>
return
None
,
...
...
src/librustdoc/clean/mod.rs
浏览文件 @
c3bc905e
...
...
@@ -12,7 +12,6 @@
//! that clean them.
pub
use
self
::
Type
::
*
;
pub
use
self
::
TypeKind
::
*
;
pub
use
self
::
VariantKind
::
*
;
pub
use
self
::
Mutability
::
*
;
pub
use
self
::
Import
::
*
;
...
...
@@ -688,7 +687,7 @@ fn clean(&self, cx: &DocContext) -> TyParamBound {
(
tcx
.lang_items
.sync_trait
()
.unwrap
(),
external_path
(
cx
,
"Sync"
,
None
,
false
,
vec!
[],
empty
)),
};
inline
::
record_extern_fqn
(
cx
,
did
,
TypeTrait
);
inline
::
record_extern_fqn
(
cx
,
did
,
Type
Kind
::
Trait
);
TraitBound
(
PolyTrait
{
trait_
:
ResolvedPath
{
path
:
path
,
...
...
@@ -707,7 +706,7 @@ fn clean(&self, cx: &DocContext) -> TyParamBound {
Some
(
tcx
)
=>
tcx
,
None
=>
return
RegionBound
(
Lifetime
::
statik
())
};
inline
::
record_extern_fqn
(
cx
,
self
.def_id
,
TypeTrait
);
inline
::
record_extern_fqn
(
cx
,
self
.def_id
,
Type
Kind
::
Trait
);
let
path
=
external_path
(
cx
,
&
tcx
.item_name
(
self
.def_id
)
.as_str
(),
Some
(
self
.def_id
),
true
,
vec!
[],
self
.substs
);
...
...
@@ -1480,16 +1479,16 @@ pub enum PrimitiveType {
#[derive(Clone,
RustcEncodable,
RustcDecodable,
Copy,
Debug)]
pub
enum
TypeKind
{
Type
Enum
,
Type
Function
,
Type
Module
,
Type
Const
,
Type
Static
,
Type
Struct
,
Type
Union
,
T
ypeT
rait
,
Type
Variant
,
Type
Type
def
,
Enum
,
Function
,
Module
,
Const
,
Static
,
Struct
,
Union
,
Trait
,
Variant
,
Typedef
,
}
pub
trait
GetDefId
{
...
...
@@ -1795,9 +1794,9 @@ fn clean(&self, cx: &DocContext) -> Type {
ty
::
TyAdt
(
def
,
substs
)
=>
{
let
did
=
def
.did
;
let
kind
=
match
def
.adt_kind
()
{
AdtKind
::
Struct
=>
TypeStruct
,
AdtKind
::
Union
=>
TypeUnion
,
AdtKind
::
Enum
=>
TypeEnum
,
AdtKind
::
Struct
=>
Type
Kind
::
Struct
,
AdtKind
::
Union
=>
Type
Kind
::
Union
,
AdtKind
::
Enum
=>
Type
Kind
::
Enum
,
};
inline
::
record_extern_fqn
(
cx
,
did
,
kind
);
let
path
=
external_path
(
cx
,
&
cx
.tcx
()
.item_name
(
did
)
.as_str
(),
...
...
@@ -1811,7 +1810,7 @@ fn clean(&self, cx: &DocContext) -> Type {
}
ty
::
TyTrait
(
ref
obj
)
=>
{
let
did
=
obj
.principal
.def_id
();
inline
::
record_extern_fqn
(
cx
,
did
,
TypeTrait
);
inline
::
record_extern_fqn
(
cx
,
did
,
Type
Kind
::
Trait
);
let
mut
typarams
=
vec!
[];
obj
.region_bound
.clean
(
cx
)
.map
(|
b
|
typarams
.push
(
RegionBound
(
b
)));
...
...
@@ -2761,16 +2760,16 @@ fn register_def(cx: &DocContext, def: Def) -> DefId {
let
tcx
=
cx
.tcx
();
let
(
did
,
kind
)
=
match
def
{
Def
::
Fn
(
i
)
=>
(
i
,
TypeFunction
),
Def
::
TyAlias
(
i
)
=>
(
i
,
TypeTypedef
),
Def
::
Enum
(
i
)
=>
(
i
,
TypeEnum
),
Def
::
Trait
(
i
)
=>
(
i
,
TypeTrait
),
Def
::
Struct
(
i
)
=>
(
i
,
TypeStruct
),
Def
::
Union
(
i
)
=>
(
i
,
TypeUnion
),
Def
::
Mod
(
i
)
=>
(
i
,
TypeModule
),
Def
::
Static
(
i
,
_
)
=>
(
i
,
TypeStatic
),
Def
::
Variant
(
i
)
=>
(
tcx
.parent_def_id
(
i
)
.unwrap
(),
TypeEnum
),
Def
::
SelfTy
(
Some
(
def_id
),
_
)
=>
(
def_id
,
TypeTrait
),
Def
::
Fn
(
i
)
=>
(
i
,
Type
Kind
::
Function
),
Def
::
TyAlias
(
i
)
=>
(
i
,
Type
Kind
::
Typedef
),
Def
::
Enum
(
i
)
=>
(
i
,
Type
Kind
::
Enum
),
Def
::
Trait
(
i
)
=>
(
i
,
Type
Kind
::
Trait
),
Def
::
Struct
(
i
)
=>
(
i
,
Type
Kind
::
Struct
),
Def
::
Union
(
i
)
=>
(
i
,
Type
Kind
::
Union
),
Def
::
Mod
(
i
)
=>
(
i
,
Type
Kind
::
Module
),
Def
::
Static
(
i
,
_
)
=>
(
i
,
Type
Kind
::
Static
),
Def
::
Variant
(
i
)
=>
(
tcx
.parent_def_id
(
i
)
.unwrap
(),
Type
Kind
::
Enum
),
Def
::
SelfTy
(
Some
(
def_id
),
_
)
=>
(
def_id
,
Type
Kind
::
Trait
),
Def
::
SelfTy
(
_
,
Some
(
impl_def_id
))
=>
{
return
impl_def_id
}
...
...
@@ -2778,7 +2777,7 @@ fn register_def(cx: &DocContext, def: Def) -> DefId {
};
if
did
.is_local
()
{
return
did
}
inline
::
record_extern_fqn
(
cx
,
did
,
kind
);
if
let
TypeTrait
=
kind
{
if
let
Type
Kind
::
Trait
=
kind
{
let
t
=
inline
::
build_external_trait
(
cx
,
tcx
,
did
);
cx
.external_traits
.borrow_mut
()
.insert
(
did
,
t
);
}
...
...
@@ -2966,7 +2965,7 @@ fn lang_struct(cx: &DocContext, did: Option<DefId>,
Some
(
did
)
=>
did
,
None
=>
return
fallback
(
box
t
.clean
(
cx
)),
};
inline
::
record_extern_fqn
(
cx
,
did
,
TypeStruct
);
inline
::
record_extern_fqn
(
cx
,
did
,
Type
Kind
::
Struct
);
ResolvedPath
{
typarams
:
None
,
did
:
did
,
...
...
src/librustdoc/html/item_type.rs
浏览文件 @
c3bc905e
...
...
@@ -90,16 +90,16 @@ fn from(item: &'a clean::Item) -> ItemType {
impl
From
<
clean
::
TypeKind
>
for
ItemType
{
fn
from
(
kind
:
clean
::
TypeKind
)
->
ItemType
{
match
kind
{
clean
::
TypeStruct
=>
ItemType
::
Struct
,
clean
::
TypeUnion
=>
ItemType
::
Union
,
clean
::
TypeEnum
=>
ItemType
::
Enum
,
clean
::
TypeFunction
=>
ItemType
::
Function
,
clean
::
TypeTrait
=>
ItemType
::
Trait
,
clean
::
TypeModule
=>
ItemType
::
Module
,
clean
::
TypeStatic
=>
ItemType
::
Static
,
clean
::
TypeConst
=>
ItemType
::
Constant
,
clean
::
TypeVariant
=>
ItemType
::
Variant
,
clean
::
TypeTypedef
=>
ItemType
::
Typedef
,
clean
::
Type
Kind
::
Struct
=>
ItemType
::
Struct
,
clean
::
Type
Kind
::
Union
=>
ItemType
::
Union
,
clean
::
Type
Kind
::
Enum
=>
ItemType
::
Enum
,
clean
::
Type
Kind
::
Function
=>
ItemType
::
Function
,
clean
::
Type
Kind
::
Trait
=>
ItemType
::
Trait
,
clean
::
Type
Kind
::
Module
=>
ItemType
::
Module
,
clean
::
Type
Kind
::
Static
=>
ItemType
::
Static
,
clean
::
Type
Kind
::
Const
=>
ItemType
::
Constant
,
clean
::
Type
Kind
::
Variant
=>
ItemType
::
Variant
,
clean
::
Type
Kind
::
Typedef
=>
ItemType
::
Typedef
,
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录