std: Change Times trait to use do instead of for
Change the former repetition::
for 5.times { }
to::
do 5.times { }
.times() cannot be broken with `break` or `return` anymore; for those
cases, use a numerical range loop instead.
This commit is contained in:
parent
7e210a8129
commit
78cde5b9fb
61 changed files with 137 additions and 151 deletions
|
|
@ -636,7 +636,7 @@ pub mod rt {
|
|||
buf.push_char(c);
|
||||
}
|
||||
buf.push_str(s);
|
||||
for diff.times {
|
||||
do diff.times {
|
||||
buf.push_char(padchar);
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -626,7 +626,7 @@ mod tests {
|
|||
let x = Exclusive::new(~~"hello");
|
||||
let x2 = x.clone();
|
||||
do task::spawn {
|
||||
for 10.times { task::yield(); } // try to let the unwrapper go
|
||||
do 10.times { task::yield(); } // try to let the unwrapper go
|
||||
fail!(); // punt it awake from its deadlock
|
||||
}
|
||||
let _z = x.unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue