Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2d76c94d
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,发现更多精彩内容 >>
提交
2d76c94d
编写于
1月 27, 2015
作者:
J
Jorge Aparicio
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
s/while let/for/g now that #21245 has been fixed
上级
c013a018
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
19 addition
and
54 deletion
+19
-54
src/libcollections/bit.rs
src/libcollections/bit.rs
+1
-3
src/libcollections/ring_buf.rs
src/libcollections/ring_buf.rs
+2
-6
src/libcollections/vec.rs
src/libcollections/vec.rs
+1
-3
src/librustc/middle/dataflow.rs
src/librustc/middle/dataflow.rs
+1
-3
src/libserialize/collection_impls.rs
src/libserialize/collection_impls.rs
+1
-3
src/libstd/ascii.rs
src/libstd/ascii.rs
+1
-4
src/libstd/rand/os.rs
src/libstd/rand/os.rs
+1
-3
src/libstd/sync/mpsc/mod.rs
src/libstd/sync/mpsc/mod.rs
+2
-6
src/libstd/sync/mpsc/mpsc_queue.rs
src/libstd/sync/mpsc/mpsc_queue.rs
+1
-3
src/libsyntax/fold.rs
src/libsyntax/fold.rs
+4
-8
src/test/bench/shootout-mandelbrot.rs
src/test/bench/shootout-mandelbrot.rs
+2
-6
src/test/bench/shootout-meteor.rs
src/test/bench/shootout-meteor.rs
+2
-6
未找到文件。
src/libcollections/bit.rs
浏览文件 @
2d76c94d
...
...
@@ -104,9 +104,7 @@
fn
reverse_bits
(
byte
:
u8
)
->
u8
{
let
mut
result
=
0
;
// FIXME(#21245) use a for loop
let
mut
iter
=
0
..
u8
::
BITS
;
while
let
Some
(
i
)
=
iter
.next
()
{
for
i
in
0
..
u8
::
BITS
{
result
|
=
((
byte
>>
i
)
&
1
)
<<
(
u8
::
BITS
-
1
-
i
);
}
result
...
...
src/libcollections/ring_buf.rs
浏览文件 @
2d76c94d
...
...
@@ -1793,9 +1793,7 @@ fn bench_new(b: &mut test::Bencher) {
fn
bench_push_back_100
(
b
:
&
mut
test
::
Bencher
)
{
let
mut
deq
=
RingBuf
::
with_capacity
(
101
);
b
.iter
(||
{
// FIXME(#21245) use a for loop
let
mut
iter
=
0
i
..
100
;
while
let
Some
(
i
)
=
iter
.next
()
{
for
i
in
0
i
..
100
{
deq
.push_back
(
i
);
}
deq
.head
=
0
;
...
...
@@ -1807,9 +1805,7 @@ fn bench_push_back_100(b: &mut test::Bencher) {
fn
bench_push_front_100
(
b
:
&
mut
test
::
Bencher
)
{
let
mut
deq
=
RingBuf
::
with_capacity
(
101
);
b
.iter
(||
{
// FIXME(#21245) use a for loop
let
mut
iter
=
0
i
..
100
;
while
let
Some
(
i
)
=
iter
.next
()
{
for
i
in
0
i
..
100
{
deq
.push_front
(
i
);
}
deq
.head
=
0
;
...
...
src/libcollections/vec.rs
浏览文件 @
2d76c94d
...
...
@@ -1567,9 +1567,7 @@ fn drop(&mut self) {
// zeroed (when moving out, because of #[unsafe_no_drop_flag]).
if
self
.cap
!=
0
{
unsafe
{
// FIXME(#21245) use a for loop
let
mut
iter
=
self
.iter
();
while
let
Some
(
x
)
=
iter
.next
()
{
for
x
in
self
.iter
()
{
ptr
::
read
(
x
);
}
dealloc
(
*
self
.ptr
,
self
.cap
)
...
...
src/librustc/middle/dataflow.rs
浏览文件 @
2d76c94d
...
...
@@ -352,9 +352,7 @@ fn each_bit<F>(&self, words: &[uint], mut f: F) -> bool where
for
(
word_index
,
&
word
)
in
words
.iter
()
.enumerate
()
{
if
word
!=
0
{
let
base_index
=
word_index
*
uint
::
BITS
;
// FIXME(#21245) use a for loop
let
mut
iter
=
0u
..
uint
::
BITS
;
while
let
Some
(
offset
)
=
iter
.next
()
{
for
offset
in
0u
..
uint
::
BITS
{
let
bit
=
1
<<
offset
;
if
(
word
&
bit
)
!=
0
{
// NB: we round up the total number of bits
...
...
src/libserialize/collection_impls.rs
浏览文件 @
2d76c94d
...
...
@@ -148,9 +148,7 @@ impl<
fn
decode
<
D
:
Decoder
>
(
d
:
&
mut
D
)
->
Result
<
EnumSet
<
T
>
,
D
::
Error
>
{
let
bits
=
try!
(
d
.read_uint
());
let
mut
set
=
EnumSet
::
new
();
// FIXME(#21245) use a for loop
let
mut
iter
=
0
..
uint
::
BITS
;
while
let
Some
(
bit
)
=
iter
.next
()
{
for
bit
in
0
..
uint
::
BITS
{
if
bits
&
(
1
<<
bit
)
!=
0
{
set
.insert
(
CLike
::
from_uint
(
1
<<
bit
));
}
...
...
src/libstd/ascii.rs
浏览文件 @
2d76c94d
...
...
@@ -232,10 +232,7 @@ pub fn escape_default<F>(c: u8, mut f: F) where
_
=>
{
f
(
b
'\\'
);
f
(
b
'x'
);
// FIXME(#21245) use a for loop
let
arr
=
[
4u
,
0u
];
let
mut
iter
=
arr
.iter
();
while
let
::
option
::
Option
::
Some
(
&
offset
)
=
::
iter
::
Iterator
::
next
(
&
mut
iter
)
{
for
&
offset
in
[
4u
,
0u
]
.iter
()
{
match
((
c
as
i32
)
>>
offset
)
&
0xf
{
i
@
0
...
9
=>
f
(
b
'0'
+
(
i
as
u8
)),
i
=>
f
(
b
'a'
+
(
i
as
u8
-
10
)),
...
...
src/libstd/rand/os.rs
浏览文件 @
2d76c94d
...
...
@@ -404,9 +404,7 @@ fn test_os_rng_tasks() {
}
// start all the tasks
// FIXME(#21245) use a for loop
let
mut
iter
=
txs
.iter
();
while
let
Some
(
tx
)
=
iter
.next
()
{
for
tx
in
txs
.iter
()
{
tx
.send
(())
.unwrap
();
}
}
...
...
src/libstd/sync/mpsc/mod.rs
浏览文件 @
2d76c94d
...
...
@@ -1476,9 +1476,7 @@ fn test_recv_iter_break() {
let
_
t
=
Thread
::
spawn
(
move
||
{
let
mut
count
=
0
;
// FIXME(#21245) use a for loop
let
mut
iter
=
rx
.iter
();
while
let
Some
(
x
)
=
iter
.next
()
{
for
x
in
rx
.iter
()
{
if
count
>=
3
{
break
;
}
else
{
...
...
@@ -1942,9 +1940,7 @@ fn test_recv_iter_break() {
let
_
t
=
Thread
::
spawn
(
move
||
{
let
mut
count
=
0
;
// FIXME(#21245) use a for loop
let
mut
iter
=
rx
.iter
();
while
let
Some
(
x
)
=
iter
.next
()
{
for
x
in
rx
.iter
()
{
if
count
>=
3
{
break
;
}
else
{
...
...
src/libstd/sync/mpsc/mpsc_queue.rs
浏览文件 @
2d76c94d
...
...
@@ -185,9 +185,7 @@ fn test() {
let
tx
=
tx
.clone
();
let
q
=
q
.clone
();
Thread
::
spawn
(
move
||
{
// FIXME(#21245) use a for loop
let
mut
iter
=
0
..
nmsgs
;
while
let
Some
(
i
)
=
iter
.next
()
{
for
i
in
0
..
nmsgs
{
q
.push
(
i
);
}
tx
.send
(())
.unwrap
();
...
...
src/libsyntax/fold.rs
浏览文件 @
2d76c94d
...
...
@@ -37,14 +37,10 @@ pub trait MoveMap<T> {
impl
<
T
>
MoveMap
<
T
>
for
Vec
<
T
>
{
fn
move_map
<
F
>
(
mut
self
,
mut
f
:
F
)
->
Vec
<
T
>
where
F
:
FnMut
(
T
)
->
T
{
// FIXME(#21245) use a for loop
{
let
mut
iter
=
self
.iter_mut
();
while
let
Some
(
p
)
=
iter
.next
()
{
unsafe
{
// FIXME(#5016) this shouldn't need to zero to be safe.
ptr
::
write
(
p
,
f
(
ptr
::
read_and_zero
(
p
)));
}
for
p
in
self
.iter_mut
()
{
unsafe
{
// FIXME(#5016) this shouldn't need to zero to be safe.
ptr
::
write
(
p
,
f
(
ptr
::
read_and_zero
(
p
)));
}
}
self
...
...
src/test/bench/shootout-mandelbrot.rs
浏览文件 @
2d76c94d
...
...
@@ -133,9 +133,7 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> {
(
i
+
1
)
*
chunk_size
};
// FIXME(#21245) use a for loop
let
mut
iter
=
vec_init_i
[
start
..
end
]
.iter
();
while
let
Some
(
&
init_i
)
=
iter
.next
()
{
for
&
init_i
in
vec_init_i
[
start
..
end
]
.iter
()
{
write_line
(
init_i
,
init_r_slice
,
&
mut
res
);
}
...
...
@@ -144,9 +142,7 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> {
})
.collect
::
<
Vec
<
_
>>
();
try!
(
writeln!
(
&
mut
out
as
&
mut
Writer
,
"P4
\n
{} {}"
,
w
,
h
));
// FIXME(#21245) use a for loop
let
mut
iter
=
data
.into_iter
();
while
let
Some
(
res
)
=
iter
.next
()
{
for
res
in
data
.into_iter
()
{
try!
(
out
.write
(
res
.join
()
.ok
()
.unwrap
()
.as_slice
()));
}
out
.flush
()
...
...
src/test/bench/shootout-meteor.rs
浏览文件 @
2d76c94d
...
...
@@ -180,9 +180,7 @@ fn make_masks() -> Vec<Vec<Vec<u64> > > {
// all unused piece can be placed on the board.
fn
is_board_unfeasible
(
board
:
u64
,
masks
:
&
Vec
<
Vec
<
Vec
<
u64
>>>
)
->
bool
{
let
mut
coverable
=
board
;
// FIXME(#21245) use a for loop
let
mut
iter
=
masks
.iter
()
.enumerate
();
while
let
Some
((
i
,
masks_at
))
=
iter
.next
()
{
for
(
i
,
masks_at
)
in
masks
.iter
()
.enumerate
()
{
if
board
&
1
<<
i
!=
0
{
continue
;
}
for
(
cur_id
,
pos_masks
)
in
masks_at
.iter
()
.enumerate
()
{
if
board
&
1
<<
(
50
+
cur_id
)
!=
0
{
continue
;
}
...
...
@@ -224,9 +222,7 @@ fn to_vec(raw_sol: &List<u64>) -> Vec<u8> {
let
mut
sol
=
repeat
(
'.'
as
u8
)
.take
(
50
)
.collect
::
<
Vec
<
_
>>
();
for
&
m
in
raw_sol
.iter
()
{
let
id
=
'0'
as
u8
+
get_id
(
m
);
// FIXME(#21245) use a for loop
let
mut
iter
=
0u
..
50
;
while
let
Some
(
i
)
=
iter
.next
()
{
for
i
in
0u
..
50
{
if
m
&
1
<<
i
!=
0
{
sol
[
i
]
=
id
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录