diff --git a/error_handling/errors1.rs b/error_handling/errors1.rs index 843e620..14ed574 100644 --- a/error_handling/errors1.rs +++ b/error_handling/errors1.rs @@ -1,3 +1,4 @@ +// errors1.rs // This function refuses to generate text to be printed on a nametag if // you pass it an empty string. It'd be nicer if it explained what the problem // was, instead of just sometimes returning `None`. The 2nd test currently diff --git a/error_handling/errors2.rs b/error_handling/errors2.rs index a9cb940..05824c1 100644 --- a/error_handling/errors2.rs +++ b/error_handling/errors2.rs @@ -1,3 +1,4 @@ +// errors2.rs // Say we're writing a game where you can buy items with tokens. All items cost // 5 tokens, and whenever you purchase items there is a processing fee of 1 // token. A player of the game will type in how many items they want to buy, diff --git a/error_handling/errors3.rs b/error_handling/errors3.rs index 3ecffbc..9b285e0 100644 --- a/error_handling/errors3.rs +++ b/error_handling/errors3.rs @@ -1,3 +1,4 @@ +// errors3.rs // This is a program that is trying to use a completed version of the // `total_cost` function from the previous exercise. It's not working though-- // we can't call the `try!` macro in the `main()` function! Why not? diff --git a/error_handling/errorsn.rs b/error_handling/errorsn.rs index e0d73da..4fb2be3 100644 --- a/error_handling/errorsn.rs +++ b/error_handling/errorsn.rs @@ -1,3 +1,4 @@ +// errorsn.rs // This is a bigger error exercise than the previous ones! // You can do it! // diff --git a/error_handling/option1.rs b/error_handling/option1.rs index 5f96184..9cf0bc9 100644 --- a/error_handling/option1.rs +++ b/error_handling/option1.rs @@ -1,3 +1,4 @@ +// option1.rs // This example panics because the second time it calls `pop`, the `vec` // is empty, so `pop` returns `None`, and `unwrap` panics if it's called // on `None`. Handle this in a more graceful way than calling `unwrap`! diff --git a/error_handling/result1.rs b/error_handling/result1.rs index 7146d1e..851ab45 100644 --- a/error_handling/result1.rs +++ b/error_handling/result1.rs @@ -1,3 +1,4 @@ +// result1.rs // Make this test pass! Scroll down for hints :) #[derive(PartialEq,Debug)] diff --git a/ex1.rs b/ex1.rs index b619495..2366991 100644 --- a/ex1.rs +++ b/ex1.rs @@ -1,3 +1,4 @@ +// ex1.rs // Make me compile! fn main() { diff --git a/ex2.rs b/ex2.rs index b0c7ca2..0fd714d 100644 --- a/ex2.rs +++ b/ex2.rs @@ -1,3 +1,4 @@ +// ex2.rs // Make me compile! fn something() -> String { diff --git a/ex3.rs b/ex3.rs index 242076f..db27ad2 100644 --- a/ex3.rs +++ b/ex3.rs @@ -1,3 +1,4 @@ +// ex3.rs // Make me compile! struct Foo { diff --git a/ex4.rs b/ex4.rs index d1ae563..362a557 100644 --- a/ex4.rs +++ b/ex4.rs @@ -1,3 +1,4 @@ +// ex4.rs // Make me compile! fn something() -> Result { diff --git a/ex5.rs b/ex5.rs index 661b15e..2eb8cfd 100644 --- a/ex5.rs +++ b/ex5.rs @@ -1,3 +1,4 @@ +// ex5.rs // Make me compile! enum Reaction<'a> { diff --git a/functions/functions1.rs b/functions/functions1.rs index 3004363..396dd56 100644 --- a/functions/functions1.rs +++ b/functions/functions1.rs @@ -1,3 +1,4 @@ +// functions1.rs // Make me compile! Scroll down for hints :) fn main() { diff --git a/functions/functions2.rs b/functions/functions2.rs index 97ed8f1..1cf95c3 100644 --- a/functions/functions2.rs +++ b/functions/functions2.rs @@ -1,3 +1,4 @@ +// functions2.rs // Make me compile! Scroll down for hints :) fn main() { diff --git a/functions/functions3.rs b/functions/functions3.rs index 3dba67c..b17543b 100644 --- a/functions/functions3.rs +++ b/functions/functions3.rs @@ -1,3 +1,4 @@ +// functions3.rs // Make me compile! Scroll down for hints :) fn main() { diff --git a/functions/functions4.rs b/functions/functions4.rs index e514b84..4da8d70 100644 --- a/functions/functions4.rs +++ b/functions/functions4.rs @@ -1,3 +1,4 @@ +// functions4.rs // Make me compile! Scroll down for hints :) // This store is having a sale where if the price is an even number, you get diff --git a/functions/functions5.rs b/functions/functions5.rs index a8d7cef..f8fac5d 100644 --- a/functions/functions5.rs +++ b/functions/functions5.rs @@ -1,3 +1,4 @@ +// functions5.rs // Make me compile! Scroll down for hints :) fn main() { diff --git a/if/if1.rs b/if/if1.rs index c2ea734..5118657 100644 --- a/if/if1.rs +++ b/if/if1.rs @@ -1,3 +1,5 @@ +// if1.rs + pub fn bigger(a: i32, b:i32) -> i32 { // Complete this function to return the bigger number! // Do not use: diff --git a/macros/macros1.rs b/macros/macros1.rs index 0e964ac..a7c78a5 100644 --- a/macros/macros1.rs +++ b/macros/macros1.rs @@ -1,3 +1,4 @@ +// macros1.rs // Make me compile! Scroll down for hints :) macro_rules! my_macro { diff --git a/macros/macros2.rs b/macros/macros2.rs index bd5a82c..bc2e56b 100644 --- a/macros/macros2.rs +++ b/macros/macros2.rs @@ -1,3 +1,4 @@ +// macros2.rs // Make me compile! Scroll down for hints :) fn main() { diff --git a/macros/macros3.rs b/macros/macros3.rs index 8281445..84c4308 100644 --- a/macros/macros3.rs +++ b/macros/macros3.rs @@ -1,3 +1,4 @@ +// macros3.rs // Make me compile, without taking the macro out of the module! Scroll down for hints :) mod macros { diff --git a/macros/macros4.rs b/macros/macros4.rs index a15e171..d844bb0 100644 --- a/macros/macros4.rs +++ b/macros/macros4.rs @@ -1,3 +1,4 @@ +// macros4.rs // Make me compile! Scroll down for hints :) macro_rules! my_macro { diff --git a/modules/modules1.rs b/modules/modules1.rs index 7163495..0e092c5 100644 --- a/modules/modules1.rs +++ b/modules/modules1.rs @@ -1,3 +1,4 @@ +// modules1.rs // Make me compile! Scroll down for hints :) mod sausage_factory { diff --git a/modules/modules2.rs b/modules/modules2.rs index e6d6f4c..fefca90 100644 --- a/modules/modules2.rs +++ b/modules/modules2.rs @@ -1,3 +1,4 @@ +// modules2.rs // Make me compile! Scroll down for hints :) mod us_presidential_frontrunners { diff --git a/move_semantics/move_semantics1.rs b/move_semantics/move_semantics1.rs index a69ff90..1f28873 100644 --- a/move_semantics/move_semantics1.rs +++ b/move_semantics/move_semantics1.rs @@ -1,3 +1,4 @@ +// move_semantics1.rs // Make me compile! Scroll down for hints :) pub fn main() { diff --git a/move_semantics/move_semantics2.rs b/move_semantics/move_semantics2.rs index 79c1c56..6e676d1 100644 --- a/move_semantics/move_semantics2.rs +++ b/move_semantics/move_semantics2.rs @@ -1,3 +1,4 @@ +// move_semantics2.rs // Make me compile without changing line 9! Scroll down for hints :) pub fn main() { diff --git a/move_semantics/move_semantics3.rs b/move_semantics/move_semantics3.rs index fec370f..7805d44 100644 --- a/move_semantics/move_semantics3.rs +++ b/move_semantics/move_semantics3.rs @@ -1,3 +1,4 @@ +// move_semantics3.rs // Make me compile without adding new lines-- just changing existing lines! // (no lines with multiple semicolons necessary!) // Scroll down for hints :) diff --git a/move_semantics/move_semantics4.rs b/move_semantics/move_semantics4.rs index 17df426..2b1ed8a 100644 --- a/move_semantics/move_semantics4.rs +++ b/move_semantics/move_semantics4.rs @@ -1,3 +1,4 @@ +// move_semantics4.rs // Refactor this code so that instead of having `vec0` and creating the vector // in `fn main`, we instead create it within `fn fill_vec` and transfer the // freshly created vector from fill_vec to its caller. Scroll for hints! diff --git a/primitive_types/primitive_types1.rs b/primitive_types/primitive_types1.rs index 95c06de..c3d11fe 100644 --- a/primitive_types/primitive_types1.rs +++ b/primitive_types/primitive_types1.rs @@ -1,3 +1,4 @@ +// primitive_types1.rs // Fill in the rest of the line that has code missing! // No hints, there's no tricks, just get used to typing these :) diff --git a/primitive_types/primitive_types2.rs b/primitive_types/primitive_types2.rs index a2c80f5..f5c8f87 100644 --- a/primitive_types/primitive_types2.rs +++ b/primitive_types/primitive_types2.rs @@ -1,3 +1,4 @@ +// primitive_types2.rs // Fill in the rest of the line that has code missing! // No hints, there's no tricks, just get used to typing these :) diff --git a/primitive_types/primitive_types3.rs b/primitive_types/primitive_types3.rs index 3476ba6..a2f9b3b 100644 --- a/primitive_types/primitive_types3.rs +++ b/primitive_types/primitive_types3.rs @@ -1,3 +1,4 @@ +// primitive_types3.rs // Create an array with at least 100 elements in it where the ??? is. // Scroll down for hints! diff --git a/primitive_types/primitive_types4.rs b/primitive_types/primitive_types4.rs index b71cc33..c20b63b 100644 --- a/primitive_types/primitive_types4.rs +++ b/primitive_types/primitive_types4.rs @@ -1,3 +1,4 @@ +// primitive_types4.rs // Get a slice out of Array a where the ??? is so that the `if` statement // returns true. Scroll down for hints!! diff --git a/primitive_types/primitive_types5.rs b/primitive_types/primitive_types5.rs index a34b750..14c2fd2 100644 --- a/primitive_types/primitive_types5.rs +++ b/primitive_types/primitive_types5.rs @@ -1,3 +1,4 @@ +// primitive_types5.rs // Destructure the `cat` tuple so that the println will work. // Scroll down for hints! diff --git a/primitive_types/primitive_types6.rs b/primitive_types/primitive_types6.rs index 7ff9c67..d016642 100644 --- a/primitive_types/primitive_types6.rs +++ b/primitive_types/primitive_types6.rs @@ -1,3 +1,4 @@ +// primitive_types6.rs // Use a tuple index to access the second element of `numbers`. // You can put this right into the `println!` where the ??? is. // Scroll down for hints! diff --git a/standard_library_types/arc1.rs b/standard_library_types/arc1.rs index a47dc19..c744a10 100644 --- a/standard_library_types/arc1.rs +++ b/standard_library_types/arc1.rs @@ -1,3 +1,4 @@ +// arc1.rs // Make this code compile by filling in a value for `shared_numbers` where the // TODO comment is and creating an initial binding for `child_numbers` // somewhere. Try not to create any copies of the `numbers` Vec! diff --git a/standard_library_types/iterator3.rs b/standard_library_types/iterator3.rs index 0e0cb3e..e973ac6 100644 --- a/standard_library_types/iterator3.rs +++ b/standard_library_types/iterator3.rs @@ -1,3 +1,4 @@ +// iterator3.rs // This is a bigger exercise than most of the others! You can do it! // Here is your mission, should you choose to accept it: // 1. Complete the divide function to get the first four tests to pass diff --git a/standard_library_types/iterators4.rs b/standard_library_types/iterators4.rs index e758bd1..13613a6 100644 --- a/standard_library_types/iterators4.rs +++ b/standard_library_types/iterators4.rs @@ -1,3 +1,5 @@ +// iterators4.rs + pub fn factorial(num: u64) -> u64 { // Complete this function to return factorial of num // Do not use: diff --git a/strings/strings1.rs b/strings/strings1.rs index 2bfbba2..2e5088f 100644 --- a/strings/strings1.rs +++ b/strings/strings1.rs @@ -1,3 +1,4 @@ +// strings1.rs // Make me compile without changing the function signature! Scroll down for hints :) fn main() { diff --git a/strings/strings2.rs b/strings/strings2.rs index 286a4f8..4239ff8 100644 --- a/strings/strings2.rs +++ b/strings/strings2.rs @@ -1,3 +1,4 @@ +// strings2.rs // Make me compile without changing the function signature! Scroll down for hints :) fn main() { diff --git a/strings/strings3.rs b/strings/strings3.rs index a4e5775..b6f6a1e 100644 --- a/strings/strings3.rs +++ b/strings/strings3.rs @@ -1,3 +1,4 @@ +// strings3.rs // Ok, here are a bunch of values-- some are `Strings`, some are `&strs`. Your // task is to call one of these two functions on each value depending on what // you think each value is. That is, add either `string_slice` or `string` diff --git a/tests/tests1.rs b/tests/tests1.rs index e189f93..959ed85 100644 --- a/tests/tests1.rs +++ b/tests/tests1.rs @@ -1,3 +1,4 @@ +// tests1.rs // Tests are important to ensure that your code does what you think it should do. // Tests can be run on this file with the following command: // rustc --test tests1.rs diff --git a/tests/tests2.rs b/tests/tests2.rs index 0ae6ddb..6775d61 100644 --- a/tests/tests2.rs +++ b/tests/tests2.rs @@ -1,3 +1,4 @@ +// tests2.rs // This test has a problem with it -- make the test compile! Make the test // pass! Make the test fail! Scroll down for hints :) diff --git a/tests/tests3.rs b/tests/tests3.rs index 1ee0f29..e041f38 100644 --- a/tests/tests3.rs +++ b/tests/tests3.rs @@ -1,3 +1,4 @@ +// tests3.rs // This test isn't testing our function -- make it do that in such a way that // the test passes. Then write a second test that tests that we get the result // we expect to get when we call `is_even(5)`. Scroll down for hints! diff --git a/tests/tests4.rs b/tests/tests4.rs index 278e29e..23d444a 100644 --- a/tests/tests4.rs +++ b/tests/tests4.rs @@ -1,3 +1,4 @@ +// tests4.rs // This test isn't testing our function -- make it do that in such a way that // the test passes. Then write a second test that tests that we get the result // we expect to get when we call `times_two` with a negative number. diff --git a/threads/threads1.rs b/threads/threads1.rs index af97552..d98db69 100644 --- a/threads/threads1.rs +++ b/threads/threads1.rs @@ -1,3 +1,4 @@ +// threads1.rs // Make this compile! Scroll down for hints :) The idea is the thread // spawned on line 17 is completing jobs while the main thread is // monitoring progress until 10 jobs are completed. If you see 6 lines diff --git a/variables/variables1.rs b/variables/variables1.rs index e0ad5de..ffd661c 100644 --- a/variables/variables1.rs +++ b/variables/variables1.rs @@ -1,3 +1,4 @@ +// variables1.rs // Make me compile! Scroll down for hints :) fn main() { diff --git a/variables/variables2.rs b/variables/variables2.rs index ca02438..348c2d8 100644 --- a/variables/variables2.rs +++ b/variables/variables2.rs @@ -1,3 +1,4 @@ +// variables2.rs // Make me compile! Scroll down for hints :) fn main() { diff --git a/variables/variables3.rs b/variables/variables3.rs index ec55a95..165a277 100644 --- a/variables/variables3.rs +++ b/variables/variables3.rs @@ -1,3 +1,4 @@ +// variables3.rs // Make me compile! Scroll down for hints :) fn main() { diff --git a/variables/variables4.rs b/variables/variables4.rs index 3f7f937..20ee64e 100644 --- a/variables/variables4.rs +++ b/variables/variables4.rs @@ -1,3 +1,4 @@ +// variables4.rs // Make me compile! Scroll down for hints :) fn main() {