rust/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
757 B
Rust
Raw Normal View History

2021-08-12 20:29:04 -05:00
// run-pass
// edition:2021
const PATTERN_REF: &str = "Hello World";
const NUMBER: i32 = 30;
const NUMBER_POINTER: *const i32 = &NUMBER;
2021-08-13 19:48:59 -05:00
pub fn edge_case_ref(event: &str) {
2021-08-12 20:29:04 -05:00
let _ = || {
match event {
PATTERN_REF => (),
_ => (),
};
};
}
2021-08-13 19:48:59 -05:00
pub fn edge_case_str(event: String) {
2021-08-12 20:29:04 -05:00
let _ = || {
match event.as_str() {
"hello" => (),
_ => (),
};
};
}
2021-08-13 19:48:59 -05:00
pub fn edge_case_raw_ptr(event: *const i32) {
2021-08-12 20:29:04 -05:00
let _ = || {
match event {
NUMBER_POINTER => (),
_ => (),
};
};
}
2021-08-13 19:48:59 -05:00
pub fn edge_case_char(event: char) {
2021-08-12 20:29:04 -05:00
let _ = || {
match event {
'a' => (),
_ => (),
};
};
}
fn main() {}