Static rustc_ap_rustc_lint_defs::builtin::OR_PATTERNS_BACK_COMPAT [−][src]
pub static OR_PATTERNS_BACK_COMPAT: &Lint
Expand description
The or_patterns_back_compat
lint detects usage of old versions of or-patterns.
Example
ⓘ
#![deny(or_patterns_back_compat)] macro_rules! match_any { ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { match $expr { $( $( $pat => $expr_arm, )+ )+ } }; } fn main() { let result: Result<i64, i32> = Err(42); let int: i64 = match_any!(result, Ok(i) | Err(i) => i.into()); assert_eq!(int, 42); }
{{produces}}
Explanation
In Rust 2021, the pat matcher will match new patterns, which include the | character.