rust/tests/pretty/postfix-match/precedence.pp
Sasha Pourcelot c8ff8a4dc7 Pretty-print parenthesis around binary in postfix match
Signed-off-by: Sasha Pourcelot <sasha.pourcelot@protonmail.com>
2024-04-29 11:34:22 +02:00

35 lines
686 B
Puppet

#![feature(prelude_import)]
#![no_std]
#![feature(postfix_match)]
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
use std::ops::Add;
//@ pretty-mode:expanded
//@ pp-exact:precedence.pp
macro_rules! repro { ($e:expr) => { $e.match { _ => {} } }; }
struct Struct {}
impl Add<Struct> for usize {
type Output = ();
fn add(self, _: Struct) -> () { () }
}
pub fn main() {
let a;
(
{ 1 } + 1).match {
_ => {}
};
(4 as usize).match { _ => {} };
(return).match { _ => {} };
(a = 42).match { _ => {} };
(|| {}).match { _ => {} };
(42..101).match { _ => {} };
(1 + Struct {}).match { _ => {} };
}