Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
5a0d747e
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,发现更多精彩内容 >>
提交
5a0d747e
编写于
12月 21, 2019
作者:
G
Guillaume Gomez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove clean::Mutability enum
上级
0a440b15
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
28 deletion
+11
-28
src/librustdoc/clean/inline.rs
src/librustdoc/clean/inline.rs
+2
-2
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+6
-17
src/librustdoc/clean/types.rs
src/librustdoc/clean/types.rs
+1
-7
src/librustdoc/html/render.rs
src/librustdoc/html/render.rs
+2
-2
未找到文件。
src/librustdoc/clean/inline.rs
浏览文件 @
5a0d747e
...
...
@@ -7,7 +7,7 @@
use
syntax_pos
::
hygiene
::
MacroKind
;
use
syntax_pos
::
Span
;
use
rustc
::
hir
;
use
rustc
::
hir
::{
self
,
Mutability
}
;
use
rustc
::
hir
::
def
::{
Res
,
DefKind
,
CtorKind
};
use
rustc
::
hir
::
def_id
::
DefId
;
use
rustc_metadata
::
creader
::
LoadedMacro
;
...
...
@@ -472,7 +472,7 @@ fn build_const(cx: &DocContext<'_>, did: DefId) -> clean::Constant {
fn
build_static
(
cx
:
&
DocContext
<
'_
>
,
did
:
DefId
,
mutable
:
bool
)
->
clean
::
Static
{
clean
::
Static
{
type_
:
cx
.tcx
.type_of
(
did
)
.clean
(
cx
),
mutability
:
if
mutable
{
clean
::
Mutable
}
else
{
clean
::
Immutable
},
mutability
:
if
mutable
{
Mutability
::
Mutable
}
else
{
Mutability
::
Immutable
},
expr
:
"
\n\n\n
"
.to_string
(),
// trigger the "[definition]" links
}
}
...
...
src/librustdoc/clean/mod.rs
浏览文件 @
5a0d747e
...
...
@@ -46,7 +46,6 @@
pub
use
self
::
types
::
*
;
pub
use
self
::
types
::
Type
::
*
;
pub
use
self
::
types
::
Mutability
::
*
;
pub
use
self
::
types
::
ItemEnum
::
*
;
pub
use
self
::
types
::
SelfTy
::
*
;
pub
use
self
::
types
::
FunctionRetTy
::
*
;
...
...
@@ -1321,15 +1320,14 @@ fn clean(&self, cx: &DocContext<'_>) -> Type {
match
self
.kind
{
TyKind
::
Never
=>
Never
,
TyKind
::
Ptr
(
ref
m
)
=>
RawPointer
(
m
.mutbl
.clean
(
cx
)
,
box
m
.ty
.clean
(
cx
)),
TyKind
::
Ptr
(
ref
m
)
=>
RawPointer
(
m
.mutbl
,
box
m
.ty
.clean
(
cx
)),
TyKind
::
Rptr
(
ref
l
,
ref
m
)
=>
{
let
lifetime
=
if
l
.is_elided
()
{
None
}
else
{
Some
(
l
.clean
(
cx
))
};
BorrowedRef
{
lifetime
,
mutability
:
m
.mutbl
.clean
(
cx
),
type_
:
box
m
.ty
.clean
(
cx
)}
BorrowedRef
{
lifetime
,
mutability
:
m
.mutbl
,
type_
:
box
m
.ty
.clean
(
cx
)}
}
TyKind
::
Slice
(
ref
ty
)
=>
Slice
(
box
ty
.clean
(
cx
)),
TyKind
::
Array
(
ref
ty
,
ref
length
)
=>
{
...
...
@@ -1547,10 +1545,10 @@ fn clean(&self, cx: &DocContext<'_>) -> Type {
let
n
=
print_const
(
cx
,
n
);
Array
(
box
ty
.clean
(
cx
),
n
)
}
ty
::
RawPtr
(
mt
)
=>
RawPointer
(
mt
.mutbl
.clean
(
cx
)
,
box
mt
.ty
.clean
(
cx
)),
ty
::
RawPtr
(
mt
)
=>
RawPointer
(
mt
.mutbl
,
box
mt
.ty
.clean
(
cx
)),
ty
::
Ref
(
r
,
ty
,
mutbl
)
=>
BorrowedRef
{
lifetime
:
r
.clean
(
cx
),
mutability
:
mutbl
.clean
(
cx
)
,
mutability
:
mutbl
,
type_
:
box
ty
.clean
(
cx
),
},
ty
::
FnDef
(
..
)
|
...
...
@@ -2073,7 +2071,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Item {
deprecation
:
cx
.deprecation
(
self
.id
)
.clean
(
cx
),
inner
:
StaticItem
(
Static
{
type_
:
self
.type_
.clean
(
cx
),
mutability
:
self
.mutability
.clean
(
cx
)
,
mutability
:
self
.mutability
,
expr
:
print_const_expr
(
cx
,
self
.expr
),
}),
}
...
...
@@ -2098,15 +2096,6 @@ fn clean(&self, cx: &DocContext<'_>) -> Item {
}
}
impl
Clean
<
Mutability
>
for
hir
::
Mutability
{
fn
clean
(
&
self
,
_
:
&
DocContext
<
'_
>
)
->
Mutability
{
match
self
{
&
hir
::
Mutability
::
Mut
=>
Mutable
,
&
hir
::
Mutability
::
Not
=>
Immutable
,
}
}
}
impl
Clean
<
ImplPolarity
>
for
ty
::
ImplPolarity
{
fn
clean
(
&
self
,
_
:
&
DocContext
<
'_
>
)
->
ImplPolarity
{
match
self
{
...
...
@@ -2296,7 +2285,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Item {
hir
::
ForeignItemKind
::
Static
(
ref
ty
,
mutbl
)
=>
{
ForeignStaticItem
(
Static
{
type_
:
ty
.clean
(
cx
),
mutability
:
mutbl
.clean
(
cx
)
,
mutability
:
*
mutbl
,
expr
:
String
::
new
(),
})
}
...
...
src/librustdoc/clean/types.rs
浏览文件 @
5a0d747e
...
...
@@ -10,7 +10,7 @@
use
rustc
::
middle
::
lang_items
;
use
rustc
::
middle
::
stability
;
use
rustc
::
hir
;
use
rustc
::
hir
::{
self
,
Mutability
}
;
use
rustc
::
hir
::
def
::
Res
;
use
rustc
::
hir
::
def_id
::{
CrateNum
,
DefId
};
use
rustc
::
ty
::
layout
::
VariantIdx
;
...
...
@@ -1450,12 +1450,6 @@ pub struct Constant {
pub
expr
:
String
,
}
#[derive(Debug,
Clone,
PartialEq,
Eq,
Copy,
Hash)]
pub
enum
Mutability
{
Mutable
,
Immutable
,
}
#[derive(Clone,
PartialEq,
Debug)]
pub
enum
ImplPolarity
{
Positive
,
...
...
src/librustdoc/html/render.rs
浏览文件 @
5a0d747e
...
...
@@ -54,12 +54,12 @@
use
rustc
::
hir
::
def_id
::
DefId
;
use
rustc
::
middle
::
privacy
::
AccessLevels
;
use
rustc
::
middle
::
stability
;
use
rustc
::
hir
;
use
rustc
::
hir
::{
self
,
Mutability
}
;
use
rustc
::
util
::
nodemap
::{
FxHashMap
,
FxHashSet
};
use
rustc_data_structures
::
flock
;
use
rustc_feature
::
UnstableFeatures
;
use
crate
::
clean
::{
self
,
AttributesExt
,
Deprecation
,
GetDefId
,
SelfTy
,
Mutability
};
use
crate
::
clean
::{
self
,
AttributesExt
,
Deprecation
,
GetDefId
,
SelfTy
};
use
crate
::
config
::
RenderOptions
;
use
crate
::
docfs
::{
DocFS
,
ErrorStorage
,
PathError
};
use
crate
::
doctree
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录