From 7d7a48b17dfb9d61b50eeced84f74e0d1f755b9c Mon Sep 17 00:00:00 2001 From: Robert Lugg Date: Wed, 21 Feb 2018 22:09:53 -0800 Subject: [PATCH] Added filename to top of .rs files --- error_handling/errors1.rs | 1 + error_handling/errors2.rs | 1 + error_handling/errors3.rs | 1 + error_handling/errorsn.rs | 1 + error_handling/option1.rs | 1 + error_handling/result1.rs | 1 + ex1.rs | 1 + ex2.rs | 1 + ex3.rs | 1 + ex4.rs | 1 + ex5.rs | 1 + functions/functions1.rs | 1 + functions/functions2.rs | 1 + functions/functions3.rs | 1 + functions/functions4.rs | 1 + functions/functions5.rs | 1 + if/if1.rs | 2 ++ macros/macros1.rs | 1 + macros/macros2.rs | 1 + macros/macros3.rs | 1 + macros/macros4.rs | 1 + modules/modules1.rs | 1 + modules/modules2.rs | 1 + move_semantics/move_semantics1.rs | 1 + move_semantics/move_semantics2.rs | 1 + move_semantics/move_semantics3.rs | 1 + move_semantics/move_semantics4.rs | 1 + primitive_types/primitive_types1.rs | 1 + primitive_types/primitive_types2.rs | 1 + primitive_types/primitive_types3.rs | 1 + primitive_types/primitive_types4.rs | 1 + primitive_types/primitive_types5.rs | 1 + primitive_types/primitive_types6.rs | 1 + standard_library_types/arc1.rs | 1 + standard_library_types/iterator3.rs | 1 + standard_library_types/iterators4.rs | 2 ++ strings/strings1.rs | 1 + strings/strings2.rs | 1 + strings/strings3.rs | 1 + tests/tests1.rs | 1 + tests/tests2.rs | 1 + tests/tests3.rs | 1 + tests/tests4.rs | 1 + threads/threads1.rs | 1 + variables/variables1.rs | 1 + variables/variables2.rs | 1 + variables/variables3.rs | 1 + variables/variables4.rs | 1 + 48 files changed, 50 insertions(+) diff --git a/error_handling/errors1.rs b/error_handling/errors1.rs index 843e6206..14ed574b 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 a9cb9407..05824c13 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 3ecffbc8..9b285e0b 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 e0d73dae..4fb2be30 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 5f961842..9cf0bc92 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 7146d1ef..851ab451 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 b619495d..2366991f 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 b0c7ca22..0fd714de 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 242076fb..db27ad2c 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 d1ae563b..362a5570 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 661b15ea..2eb8cfd6 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 30043632..396dd56f 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 97ed8f1d..1cf95c32 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 3dba67cc..b17543b3 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 e514b84f..4da8d705 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 a8d7cef0..f8fac5d2 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 c2ea7345..51186577 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 0e964ac5..a7c78a57 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 bd5a82cf..bc2e56be 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 82814457..84c4308e 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 a15e1713..d844bb0d 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 71634950..0e092c5f 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 e6d6f4c5..fefca904 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 a69ff90f..1f288731 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 79c1c56d..6e676d14 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 fec370f9..7805d442 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 17df4267..2b1ed8aa 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 95c06de2..c3d11fe8 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 a2c80f50..f5c8f87a 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 3476ba66..a2f9b3b3 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 b71cc330..c20b63bb 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 a34b750f..14c2fd26 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 7ff9c675..d0166428 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 a47dc19f..c744a108 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 0e0cb3e1..e973ac64 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 e758bd17..13613a6c 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 2bfbba2d..2e5088f9 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 286a4f80..4239ff8f 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 a4e57754..b6f6a1ea 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 e189f937..959ed85e 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 0ae6ddb8..6775d610 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 1ee0f291..e041f385 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 278e29e8..23d444ad 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 af975521..d98db694 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 e0ad5de8..ffd661ce 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 ca024387..348c2d80 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 ec55a951..165a2779 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 3f7f937d..20ee64e6 100644 --- a/variables/variables4.rs +++ b/variables/variables4.rs @@ -1,3 +1,4 @@ +// variables4.rs // Make me compile! Scroll down for hints :) fn main() {