Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
5c58eec0
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,发现更多精彩内容 >>
提交
5c58eec0
编写于
4月 04, 2018
作者:
C
Clar Charr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace manual iter exhaust with for_each(drop).
上级
178becdd
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
9 addition
and
13 deletion
+9
-13
src/liballoc/btree/map.rs
src/liballoc/btree/map.rs
+1
-2
src/liballoc/linked_list.rs
src/liballoc/linked_list.rs
+1
-1
src/liballoc/vec.rs
src/liballoc/vec.rs
+3
-6
src/liballoc/vec_deque.rs
src/liballoc/vec_deque.rs
+1
-1
src/librustc_data_structures/array_vec.rs
src/librustc_data_structures/array_vec.rs
+2
-2
src/libstd/collections/hash/table.rs
src/libstd/collections/hash/table.rs
+1
-1
未找到文件。
src/liballoc/btree/map.rs
浏览文件 @
5c58eec0
...
...
@@ -1260,8 +1260,7 @@ fn into_iter(self) -> IntoIter<K, V> {
#[stable(feature
=
"btree_drop"
,
since
=
"1.7.0"
)]
impl
<
K
,
V
>
Drop
for
IntoIter
<
K
,
V
>
{
fn
drop
(
&
mut
self
)
{
for
_
in
&
mut
*
self
{
}
self
.for_each
(
drop
);
unsafe
{
let
leaf_node
=
ptr
::
read
(
&
self
.front
)
.into_node
();
if
let
Some
(
first_parent
)
=
leaf_node
.deallocate_and_ascend
()
{
...
...
src/liballoc/linked_list.rs
浏览文件 @
5c58eec0
...
...
@@ -1076,7 +1076,7 @@ impl<'a, T, F> Drop for DrainFilter<'a, T, F>
where
F
:
FnMut
(
&
mut
T
)
->
bool
,
{
fn
drop
(
&
mut
self
)
{
for
_
in
self
{
}
self
.for_each
(
drop
);
}
}
...
...
src/liballoc/vec.rs
浏览文件 @
5c58eec0
...
...
@@ -2354,7 +2354,7 @@ fn next_back(&mut self) -> Option<T> {
impl
<
'a
,
T
>
Drop
for
Drain
<
'a
,
T
>
{
fn
drop
(
&
mut
self
)
{
// exhaust self first
while
let
Some
(
_
)
=
self
.next
()
{}
self
.for_each
(
drop
);
if
self
.tail_len
>
0
{
unsafe
{
...
...
@@ -2474,9 +2474,7 @@ impl<'a, I: Iterator> ExactSizeIterator for Splice<'a, I> {}
#[stable(feature
=
"vec_splice"
,
since
=
"1.21.0"
)]
impl
<
'a
,
I
:
Iterator
>
Drop
for
Splice
<
'a
,
I
>
{
fn
drop
(
&
mut
self
)
{
// exhaust drain first
while
let
Some
(
_
)
=
self
.drain
.next
()
{}
self
.drain
.by_ref
()
.for_each
(
drop
);
unsafe
{
if
self
.drain.tail_len
==
0
{
...
...
@@ -2605,8 +2603,7 @@ impl<'a, T, F> Drop for DrainFilter<'a, T, F>
where
F
:
FnMut
(
&
mut
T
)
->
bool
,
{
fn
drop
(
&
mut
self
)
{
for
_
in
self
.by_ref
()
{
}
self
.for_each
(
drop
);
unsafe
{
self
.vec
.set_len
(
self
.old_len
-
self
.del
);
}
...
...
src/liballoc/vec_deque.rs
浏览文件 @
5c58eec0
...
...
@@ -2177,7 +2177,7 @@ unsafe impl<'a, T: Send> Send for Drain<'a, T> {}
#[stable(feature
=
"drain"
,
since
=
"1.6.0"
)]
impl
<
'a
,
T
:
'a
>
Drop
for
Drain
<
'a
,
T
>
{
fn
drop
(
&
mut
self
)
{
for
_
in
self
.by_ref
()
{}
self
.for_each
(
drop
);
let
source_deque
=
unsafe
{
self
.deque
.as_mut
()
};
...
...
src/librustc_data_structures/array_vec.rs
浏览文件 @
5c58eec0
...
...
@@ -207,7 +207,7 @@ pub struct Iter<A: Array> {
impl
<
A
:
Array
>
Drop
for
Iter
<
A
>
{
fn
drop
(
&
mut
self
)
{
for
_
in
self
{}
self
.for_each
(
drop
);
}
}
...
...
@@ -251,7 +251,7 @@ fn size_hint(&self) -> (usize, Option<usize>) {
impl
<
'a
,
A
:
Array
>
Drop
for
Drain
<
'a
,
A
>
{
fn
drop
(
&
mut
self
)
{
// exhaust self first
while
let
Some
(
_
)
=
self
.next
()
{}
self
.for_each
(
drop
);
if
self
.tail_len
>
0
{
unsafe
{
...
...
src/libstd/collections/hash/table.rs
浏览文件 @
5c58eec0
...
...
@@ -1129,7 +1129,7 @@ fn len(&self) -> usize {
impl
<
'a
,
K
:
'a
,
V
:
'a
>
Drop
for
Drain
<
'a
,
K
,
V
>
{
fn
drop
(
&
mut
self
)
{
for
_
in
self
{}
self
.for_each
(
drop
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录