summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-07-01 11:28:38 +0200
committermo8it <mo8it@proton.me>2024-07-01 11:28:38 +0200
commitcf90364fd779255074eac9a7d90c53ad657936ba (patch)
tree669c886315962f7d3f3d23c53b64fdb4281b91bd
parenta13e3cd07f86e8668a326bae98568cced61f5015 (diff)
macros1 solution
-rw-r--r--exercises/21_macros/macros1.rs1
-rw-r--r--rustlings-macros/info.toml5
-rw-r--r--solutions/21_macros/macros1.rs11
3 files changed, 13 insertions, 4 deletions
diff --git a/exercises/21_macros/macros1.rs b/exercises/21_macros/macros1.rs
index 1d415cb..fb3c3ff 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 24dcdee..7dcf344 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 4e18198..1b86156 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!();
+ // ^
+}