rust/tests/pretty/if-else.pp
Lukas Bergdoll 506762f3ff Explicitly export core and std macros
Currently all core and std macros are automatically added to the prelude
via #[macro_use]. However a situation arose where we want to add a new macro
`assert_matches` but don't want to pull it into the standard prelude for
compatibility reasons. By explicitly exporting the macros found in the core and
std crates we get to decide on a per macro basis and can later add them via
the rust_20xx preludes.
2026-01-13 08:47:48 +01:00

51 lines
939 B
Rust

#![feature(prelude_import)]
#![no_std]
extern crate std;
#[prelude_import]
use ::std::prelude::rust_2015::*;
//@ pretty-compare-only
//@ pretty-mode:expanded
//@ pp-exact:if-else.pp
fn f(x: u32, y: u32) {
let mut a = 0;
if x > y { a = 1; } else { a = 2; }
if x < 1 {
a = 1;
} else if x < 2 {
a = 2;
} else if x < 3 { a = 3; } else if x < 4 { a = 4; } else { a = 5; }
if x < y {
a += 1;
a += 1;
a += 1;
} else {
a += 1;
a += 1;
a += 1;
a += 1;
a += 1;
a += 1;
a += 1;
a += 1;
a += 1;
a += 1;
a += 1;
a += 1;
a += 1;
a += 1;
a += 1;
}
if x < 1 {
if x < 2 {
if x < 3 {
a += 1;
} else if x < 4 { a += 1; if x < 5 { a += 1; } }
} else if x < 6 { a += 1; }
}
}
fn main() { f(3, 4); }