diff --git a/exercises/macros/macros1.rs b/exercises/macros/macros1.rs index a7c78a5..2471126 100755 --- a/exercises/macros/macros1.rs +++ b/exercises/macros/macros1.rs @@ -8,7 +8,7 @@ macro_rules! my_macro { } fn main() { - my_macro(); + my_macro!(); } diff --git a/exercises/macros/macros2.rs b/exercises/macros/macros2.rs index bc2e56b..5c23efd 100755 --- a/exercises/macros/macros2.rs +++ b/exercises/macros/macros2.rs @@ -1,17 +1,15 @@ // macros2.rs // Make me compile! Scroll down for hints :) -fn main() { - my_macro!(); -} - macro_rules! my_macro { () => { println!("Check out my macro!"); }; } - +fn main() { + my_macro!(); +} diff --git a/exercises/macros/macros3.rs b/exercises/macros/macros3.rs index 84c4308..71213d4 100755 --- a/exercises/macros/macros3.rs +++ b/exercises/macros/macros3.rs @@ -1,6 +1,7 @@ // macros3.rs // Make me compile, without taking the macro out of the module! Scroll down for hints :) +#[macro_use] mod macros { macro_rules! my_macro { () => { diff --git a/exercises/macros/macros4.rs b/exercises/macros/macros4.rs index d844bb0..9369ff5 100755 --- a/exercises/macros/macros4.rs +++ b/exercises/macros/macros4.rs @@ -4,7 +4,7 @@ macro_rules! my_macro { () => { println!("Check out my macro!"); - } + }; ($val:expr) => { println!("Look at this other macro: {}", $val); } diff --git a/exercises/move_semantics/move_semantics1.rs b/exercises/move_semantics/move_semantics1.rs index 37038ec..f75714b 100755 --- a/exercises/move_semantics/move_semantics1.rs +++ b/exercises/move_semantics/move_semantics1.rs @@ -4,7 +4,7 @@ fn main() { let vec0 = Vec::new(); - let vec1 = fill_vec(vec0); + let mut vec1 = fill_vec(vec0); println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1); diff --git a/exercises/test4.rs b/exercises/test4.rs index e50f1b0..e4468ff 100644 --- a/exercises/test4.rs +++ b/exercises/test4.rs @@ -5,6 +5,11 @@ // Write a macro that passes the test! No hints this time, you can do it! +macro_rules! my_macro { + ($var:expr) => { //or just ("world!") + "Hello world!" + } +} fn main() { if my_macro!("world!") != "Hello world!" { panic!("Oh no! Wrong output!");