mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
36 lines
533 B
Rust
36 lines
533 B
Rust
|
#![allow(unused_assignments)]
|
||
|
// expect-exit-status-1
|
||
|
|
||
|
fn call(return_error: bool) -> Result<(),()> {
|
||
|
if return_error {
|
||
|
Err(())
|
||
|
} else {
|
||
|
Ok(())
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn main() -> Result<(),()> {
|
||
|
let mut
|
||
|
countdown = 10
|
||
|
;
|
||
|
for
|
||
|
_
|
||
|
in
|
||
|
0..10
|
||
|
{
|
||
|
countdown
|
||
|
-= 1
|
||
|
;
|
||
|
if
|
||
|
countdown < 5
|
||
|
{
|
||
|
call(/*return_error=*/ true)?;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
call(/*return_error=*/ false)?;
|
||
|
}
|
||
|
}
|
||
|
Ok(())
|
||
|
}
|