From 72e9ac2f36c9037abf79f2f05ac371e787dfb453 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 10 May 2024 13:56:51 +0100 Subject: [PATCH] use multiplication --- src/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index e44b451..bdf2b1d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,18 +2,18 @@ use foo_macros::*; macro_rules! one_plus { { $v:expr } => { - 1 + $v + 2 * $v } } macro_rules! one_plus_dbg { { $v:expr } => { - dbg_dump!(1 + $v) + dbg_dump!(2 * $v) } } macro_rules! one_plus_reconstruct { { $v:expr } => { - reconstruct_groups!(1 + $v) + reconstruct_groups!(2 * $v) } } fn main() { - println!("1 + (2<<3) should be 17"); - println!("{} without proc_macro", one_plus!(2 << 3)); - println!("{} dbg_dump", one_plus_dbg!(2 << 3)); - println!("{} reconstruct", one_plus_reconstruct!(2 << 3)); + println!("2 * (3 + 4) should be 14"); + println!("{} without proc_macro", one_plus!(3 + 4)); + println!("{} dbg_dump", one_plus_dbg!(3 + 4)); + println!("{} reconstruct", one_plus_reconstruct!(3 + 4)); } -- 2.30.2