From cf90364fd779255074eac9a7d90c53ad657936ba Mon Sep 17 00:00:00 2001 From: mo8it Date: Mon, 1 Jul 2024 11:28:38 +0200 Subject: [PATCH] macros1 solution --- exercises/21_macros/macros1.rs | 1 + rustlings-macros/info.toml | 5 ++--- solutions/21_macros/macros1.rs | 11 ++++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/exercises/21_macros/macros1.rs b/exercises/21_macros/macros1.rs index 1d415cb1..fb3c3ff9 100644 --- a/exercises/21_macros/macros1.rs +++ b/exercises/21_macros/macros1.rs @@ -5,5 +5,6 @@ macro_rules! my_macro { } fn main() { + // TODO: Fix the macro call. my_macro(); } diff --git a/rustlings-macros/info.toml b/rustlings-macros/info.toml index 24dcdee2..7dcf3441 100644 --- a/rustlings-macros/info.toml +++ b/rustlings-macros/info.toml @@ -1089,9 +1089,8 @@ name = "macros1" dir = "21_macros" test = false hint = """ -When you call a macro, you need to add something special compared to a -regular function call. If you're stuck, take a look at what's inside -`my_macro`.""" +When you call a macro, you need to add something special compared to a regular +function call.""" [[exercises]] name = "macros2" diff --git a/solutions/21_macros/macros1.rs b/solutions/21_macros/macros1.rs index 4e181989..1b861564 100644 --- a/solutions/21_macros/macros1.rs +++ b/solutions/21_macros/macros1.rs @@ -1 +1,10 @@ -// Solutions will be available before the stable release. Thank you for testing the beta version 🥰 +macro_rules! my_macro { + () => { + println!("Check out my macro!"); + }; +} + +fn main() { + my_macro!(); + // ^ +}