Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
938c8c18
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,发现更多精彩内容 >>
提交
938c8c18
编写于
2月 28, 2016
作者:
M
mitaa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
This doesn't seem necessary?
上级
d78f19eb
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
17 addition
and
37 deletion
+17
-37
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+0
-6
src/librustdoc/fold.rs
src/librustdoc/fold.rs
+14
-26
src/librustdoc/html/render.rs
src/librustdoc/html/render.rs
+1
-1
src/librustdoc/passes.rs
src/librustdoc/passes.rs
+2
-4
未找到文件。
src/librustdoc/clean/mod.rs
浏览文件 @
938c8c18
...
...
@@ -507,12 +507,6 @@ fn value_str(&self) -> Option<InternedString> {
fn
meta_item_list
<
'a
>
(
&
'a
self
)
->
Option
<&
'a
[
P
<
ast
::
MetaItem
>
]
>
{
None
}
fn
span
(
&
self
)
->
codemap
::
Span
{
unimplemented!
()
}
}
impl
<
'a
>
attr
::
AttrMetaMethods
for
&
'a
Attribute
{
fn
name
(
&
self
)
->
InternedString
{
(
**
self
)
.name
()
}
fn
value_str
(
&
self
)
->
Option
<
InternedString
>
{
(
**
self
)
.value_str
()
}
fn
meta_item_list
(
&
self
)
->
Option
<&
[
P
<
ast
::
MetaItem
>
]
>
{
None
}
fn
span
(
&
self
)
->
codemap
::
Span
{
unimplemented!
()
}
}
#[derive(Clone,
RustcEncodable,
RustcDecodable,
PartialEq,
Debug)]
pub
struct
TyParam
{
...
...
src/librustdoc/fold.rs
浏览文件 @
938c8c18
...
...
@@ -9,8 +9,6 @@
// except according to those terms.
use
clean
::
*
;
use
std
::
collections
::
HashMap
;
use
std
::
mem
::{
replace
,
swap
};
pub
trait
DocFolder
:
Sized
{
fn
fold_item
(
&
mut
self
,
item
:
Item
)
->
Option
<
Item
>
{
...
...
@@ -20,12 +18,10 @@ fn fold_item(&mut self, item: Item) -> Option<Item> {
/// don't override!
fn
fold_item_recur
(
&
mut
self
,
item
:
Item
)
->
Option
<
Item
>
{
let
Item
{
attrs
,
name
,
source
,
visibility
,
def_id
,
inner
,
stability
,
deprecation
}
=
item
;
let
inner
=
inner
;
let
inner
=
match
inner
{
StructItem
(
mut
i
)
=>
{
let
mut
foo
=
Vec
::
new
();
swap
(
&
mut
foo
,
&
mut
i
.fields
);
let
num_fields
=
foo
.len
();
i
.fields
.extend
(
foo
.into_iter
()
.filter_map
(|
x
|
self
.fold_item
(
x
)));
let
num_fields
=
i
.fields
.len
();
i
.fields
=
i
.fields
.into_iter
()
.filter_map
(|
x
|
self
.fold_item
(
x
))
.collect
();
i
.fields_stripped
|
=
num_fields
!=
i
.fields
.len
();
StructItem
(
i
)
},
...
...
@@ -33,29 +29,25 @@ fn fold_item_recur(&mut self, item: Item) -> Option<Item> {
ModuleItem
(
self
.fold_mod
(
i
))
},
EnumItem
(
mut
i
)
=>
{
let
mut
foo
=
Vec
::
new
();
swap
(
&
mut
foo
,
&
mut
i
.variants
);
let
num_variants
=
foo
.len
();
i
.variants
.extend
(
foo
.into_iter
()
.filter_map
(|
x
|
self
.fold_item
(
x
)));
let
num_variants
=
i
.variants
.len
();
i
.variants
=
i
.variants
.into_iter
()
.filter_map
(|
x
|
self
.fold_item
(
x
))
.collect
();
i
.variants_stripped
|
=
num_variants
!=
i
.variants
.len
();
EnumItem
(
i
)
},
TraitItem
(
mut
i
)
=>
{
let
mut
foo
=
Vec
::
new
();
swap
(
&
mut
foo
,
&
mut
i
.items
);
i
.items
.extend
(
foo
.into_iter
()
.filter_map
(|
x
|
self
.fold_item
(
x
)));
i
.items
=
i
.items
.into_iter
()
.filter_map
(|
x
|
self
.fold_item
(
x
))
.collect
();
TraitItem
(
i
)
},
ImplItem
(
mut
i
)
=>
{
let
mut
foo
=
Vec
::
new
();
swap
(
&
mut
foo
,
&
mut
i
.items
);
i
.items
.extend
(
foo
.into_iter
()
.filter_map
(|
x
|
self
.fold_item
(
x
)));
i
.items
=
i
.items
.into_iter
()
.filter_map
(|
x
|
self
.fold_item
(
x
))
.collect
();
ImplItem
(
i
)
},
VariantItem
(
i
)
=>
{
let
i2
=
i
.clone
();
// this clone is small
match
i
.kind
{
StructVariant
(
mut
j
)
=>
{
let
mut
foo
=
Vec
::
new
();
swap
(
&
mut
foo
,
&
mut
j
.fields
);
let
num_fields
=
foo
.len
();
j
.fields
.extend
(
foo
.into_iter
()
.filter_map
(|
x
|
self
.fold_item
(
x
)));
let
num_fields
=
j
.fields
.len
();
j
.fields
=
j
.fields
.into_iter
()
.filter_map
(|
x
|
self
.fold_item
(
x
))
.collect
();
j
.fields_stripped
|
=
num_fields
!=
j
.fields
.len
();
VariantItem
(
Variant
{
kind
:
StructVariant
(
j
),
..
i2
})
},
...
...
@@ -78,17 +70,13 @@ fn fold_mod(&mut self, m: Module) -> Module {
}
fn
fold_crate
(
&
mut
self
,
mut
c
:
Crate
)
->
Crate
{
c
.module
=
match
replace
(
&
mut
c
.module
,
None
)
{
Some
(
module
)
=>
self
.fold_item
(
module
),
None
=>
None
};
let
external_traits
=
replace
(
&
mut
c
.external_traits
,
HashMap
::
new
());
c
.external_traits
=
external_traits
.into_iter
()
.map
(|(
k
,
mut
v
)|
{
let
items
=
replace
(
&
mut
v
.items
,
Vec
::
new
());
v
.items
=
items
.into_iter
()
.filter_map
(|
i
|
self
.fold_item
(
i
))
.collect
();
c
.module
=
c
.module
.and_then
(|
module
|
{
self
.fold_item
(
module
)
});
c
.external_traits
=
c
.external_traits
.into_iter
()
.map
(|(
k
,
mut
v
)|
{
v
.items
=
v
.items
.into_iter
()
.filter_map
(|
i
|
self
.fold_item
(
i
))
.collect
();
(
k
,
v
)
})
.collect
();
return
c
;
c
}
}
src/librustdoc/html/render.rs
浏览文件 @
938c8c18
...
...
@@ -374,7 +374,7 @@ fn init_ids() -> HashMap<String, usize> {
"deref-methods"
,
"implementations"
,
"derived_implementations"
]
.into_iter
()
.map
(|
id
|
(
String
::
from
(
*
id
),
1
))
.collect
::
<
HashMap
<
_
,
_
>>
()
]
.into_iter
()
.map
(|
id
|
(
String
::
from
(
*
id
),
1
))
.collect
()
}
/// This method resets the local table of used ID attributes. This is typically
...
...
src/librustdoc/passes.rs
浏览文件 @
938c8c18
...
...
@@ -243,8 +243,7 @@ fn fold_item(&mut self, i: Item) -> Option<Item> {
pub
fn
unindent_comments
(
krate
:
clean
::
Crate
)
->
plugins
::
PluginResult
{
struct
CommentCleaner
;
impl
fold
::
DocFolder
for
CommentCleaner
{
fn
fold_item
(
&
mut
self
,
i
:
Item
)
->
Option
<
Item
>
{
let
mut
i
=
i
;
fn
fold_item
(
&
mut
self
,
mut
i
:
Item
)
->
Option
<
Item
>
{
let
mut
avec
:
Vec
<
clean
::
Attribute
>
=
Vec
::
new
();
for
attr
in
&
i
.attrs
{
match
attr
{
...
...
@@ -268,9 +267,8 @@ fn fold_item(&mut self, i: Item) -> Option<Item> {
pub
fn
collapse_docs
(
krate
:
clean
::
Crate
)
->
plugins
::
PluginResult
{
struct
Collapser
;
impl
fold
::
DocFolder
for
Collapser
{
fn
fold_item
(
&
mut
self
,
i
:
Item
)
->
Option
<
Item
>
{
fn
fold_item
(
&
mut
self
,
mut
i
:
Item
)
->
Option
<
Item
>
{
let
mut
docstr
=
String
::
new
();
let
mut
i
=
i
;
for
attr
in
&
i
.attrs
{
if
let
clean
::
NameValue
(
ref
x
,
ref
s
)
=
*
attr
{
if
"doc"
==
*
x
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录