mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-22 05:52:23 -05:00
Remove "I AM NOT DONE" and the verify mode and add AppState
This commit is contained in:
parent
4bb6bda9f6
commit
fa1f239a70
113 changed files with 306 additions and 769 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -699,7 +699,6 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"toml_edit",
|
"toml_edit",
|
||||||
"which",
|
"which",
|
||||||
"winnow",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -44,7 +44,6 @@ serde_json = "1.0.115"
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
toml_edit.workspace = true
|
toml_edit.workspace = true
|
||||||
which = "6.0.1"
|
which = "6.0.1"
|
||||||
winnow = "0.6.5"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_cmd = "2.0.14"
|
assert_cmd = "2.0.14"
|
||||||
|
|
|
@ -101,13 +101,7 @@ The task is simple. Most exercises contain an error that keeps them from compili
|
||||||
rustlings watch
|
rustlings watch
|
||||||
```
|
```
|
||||||
|
|
||||||
This will try to verify the completion of every exercise in a predetermined order (what we think is best for newcomers). It will also rerun automatically every time you change a file in the `exercises/` directory. If you want to only run it once, you can use:
|
This will try to verify the completion of every exercise in a predetermined order (what we think is best for newcomers). It will also rerun automatically every time you change a file in the `exercises/` directory.
|
||||||
|
|
||||||
```bash
|
|
||||||
rustlings verify
|
|
||||||
```
|
|
||||||
|
|
||||||
This will do the same as watch, but it'll quit after running.
|
|
||||||
|
|
||||||
In case you want to go by your own order, or want to only verify a single exercise, you can run:
|
In case you want to go by your own order, or want to only verify a single exercise, you can run:
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// intro1.rs
|
// intro1.rs
|
||||||
//
|
//
|
||||||
// About this `I AM NOT DONE` thing:
|
// TODO: Update comment
|
||||||
// We sometimes encourage you to keep trying things on a given exercise, even
|
// We sometimes encourage you to keep trying things on a given exercise, even
|
||||||
// after you already figured it out. If you got everything working and feel
|
// after you already figured it out. If you got everything working and feel
|
||||||
// ready for the next exercise, remove the `I AM NOT DONE` comment below.
|
// ready for the next exercise, remove the `I AM NOT DONE` comment below.
|
||||||
|
@ -13,8 +13,6 @@
|
||||||
// Execute `rustlings hint intro1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint intro1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello and");
|
println!("Hello and");
|
||||||
println!(r#" welcome to... "#);
|
println!(r#" welcome to... "#);
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint intro2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint intro2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
printline!("Hello there!")
|
printline!("Hello there!")
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint variables1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint variables1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
x = 5;
|
x = 5;
|
||||||
println!("x has the value {}", x);
|
println!("x has the value {}", x);
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint variables2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint variables2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x;
|
let x;
|
||||||
if x == 10 {
|
if x == 10 {
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint variables3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint variables3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: i32;
|
let x: i32;
|
||||||
println!("Number {}", x);
|
println!("Number {}", x);
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint variables4` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint variables4` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = 3;
|
let x = 3;
|
||||||
println!("Number {}", x);
|
println!("Number {}", x);
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint variables5` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint variables5` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let number = "T-H-R-E-E"; // don't change this line
|
let number = "T-H-R-E-E"; // don't change this line
|
||||||
println!("Spell a Number : {}", number);
|
println!("Spell a Number : {}", number);
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint variables6` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint variables6` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
const NUMBER = 3;
|
const NUMBER = 3;
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Number {}", NUMBER);
|
println!("Number {}", NUMBER);
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint functions1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint functions1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
call_me();
|
call_me();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint functions2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint functions2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
call_me(3);
|
call_me(3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint functions3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint functions3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
call_me();
|
call_me();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// Execute `rustlings hint functions4` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint functions4` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let original_price = 51;
|
let original_price = 51;
|
||||||
println!("Your sale price is {}", sale_price(original_price));
|
println!("Your sale price is {}", sale_price(original_price));
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint functions5` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint functions5` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let answer = square(3);
|
let answer = square(3);
|
||||||
println!("The square of 3 is {}", answer);
|
println!("The square of 3 is {}", answer);
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint if1` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint if1` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub fn bigger(a: i32, b: i32) -> i32 {
|
pub fn bigger(a: i32, b: i32) -> i32 {
|
||||||
// Complete this function to return the bigger number!
|
// Complete this function to return the bigger number!
|
||||||
// If both numbers are equal, any of them can be returned.
|
// If both numbers are equal, any of them can be returned.
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint if2` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint if2` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub fn foo_if_fizz(fizzish: &str) -> &str {
|
pub fn foo_if_fizz(fizzish: &str) -> &str {
|
||||||
if fizzish == "fizz" {
|
if fizzish == "fizz" {
|
||||||
"foo"
|
"foo"
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint if3` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint if3` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub fn animal_habitat(animal: &str) -> &'static str {
|
pub fn animal_habitat(animal: &str) -> &'static str {
|
||||||
let identifier = if animal == "crab" {
|
let identifier = if animal == "crab" {
|
||||||
1
|
1
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Fill in the rest of the line that has code missing! No hints, there's no
|
// Fill in the rest of the line that has code missing! No hints, there's no
|
||||||
// tricks, just get used to typing these :)
|
// tricks, just get used to typing these :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Booleans (`bool`)
|
// Booleans (`bool`)
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Fill in the rest of the line that has code missing! No hints, there's no
|
// Fill in the rest of the line that has code missing! No hints, there's no
|
||||||
// tricks, just get used to typing these :)
|
// tricks, just get used to typing these :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Characters (`char`)
|
// Characters (`char`)
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint primitive_types3` or use the `hint` watch subcommand
|
// Execute `rustlings hint primitive_types3` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = ???
|
let a = ???
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint primitive_types4` or use the `hint` watch subcommand
|
// Execute `rustlings hint primitive_types4` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn slice_out_of_array() {
|
fn slice_out_of_array() {
|
||||||
let a = [1, 2, 3, 4, 5];
|
let a = [1, 2, 3, 4, 5];
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint primitive_types5` or use the `hint` watch subcommand
|
// Execute `rustlings hint primitive_types5` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let cat = ("Furry McFurson", 3.5);
|
let cat = ("Furry McFurson", 3.5);
|
||||||
let /* your pattern here */ = cat;
|
let /* your pattern here */ = cat;
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
// Execute `rustlings hint primitive_types6` or use the `hint` watch subcommand
|
// Execute `rustlings hint primitive_types6` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn indexing_tuple() {
|
fn indexing_tuple() {
|
||||||
let numbers = (1, 2, 3);
|
let numbers = (1, 2, 3);
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint vecs1` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint vecs1` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn array_and_vec() -> ([i32; 4], Vec<i32>) {
|
fn array_and_vec() -> ([i32; 4], Vec<i32>) {
|
||||||
let a = [10, 20, 30, 40]; // a plain array
|
let a = [10, 20, 30, 40]; // a plain array
|
||||||
let v = // TODO: declare your vector here with the macro for vectors
|
let v = // TODO: declare your vector here with the macro for vectors
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint vecs2` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint vecs2` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn vec_loop(mut v: Vec<i32>) -> Vec<i32> {
|
fn vec_loop(mut v: Vec<i32>) -> Vec<i32> {
|
||||||
for element in v.iter_mut() {
|
for element in v.iter_mut() {
|
||||||
// TODO: Fill this up so that each element in the Vec `v` is
|
// TODO: Fill this up so that each element in the Vec `v` is
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint move_semantics1` or use the `hint` watch subcommand
|
// Execute `rustlings hint move_semantics1` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn main() {
|
fn main() {
|
||||||
let vec0 = vec![22, 44, 66];
|
let vec0 = vec![22, 44, 66];
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint move_semantics2` or use the `hint` watch subcommand
|
// Execute `rustlings hint move_semantics2` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn main() {
|
fn main() {
|
||||||
let vec0 = vec![22, 44, 66];
|
let vec0 = vec![22, 44, 66];
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
// Execute `rustlings hint move_semantics3` or use the `hint` watch subcommand
|
// Execute `rustlings hint move_semantics3` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn main() {
|
fn main() {
|
||||||
let vec0 = vec![22, 44, 66];
|
let vec0 = vec![22, 44, 66];
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
// Execute `rustlings hint move_semantics4` or use the `hint` watch subcommand
|
// Execute `rustlings hint move_semantics4` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn main() {
|
fn main() {
|
||||||
let vec0 = vec![22, 44, 66];
|
let vec0 = vec![22, 44, 66];
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
// Execute `rustlings hint move_semantics5` or use the `hint` watch subcommand
|
// Execute `rustlings hint move_semantics5` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x = 100;
|
let mut x = 100;
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint move_semantics6` or use the `hint` watch subcommand
|
// Execute `rustlings hint move_semantics6` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let data = "Rust is great!".to_string();
|
let data = "Rust is great!".to_string();
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint structs1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint structs1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
struct ColorClassicStruct {
|
struct ColorClassicStruct {
|
||||||
// TODO: Something goes here
|
// TODO: Something goes here
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint structs2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint structs2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Order {
|
struct Order {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
// Execute `rustlings hint structs3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint structs3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Package {
|
struct Package {
|
||||||
sender_country: String,
|
sender_country: String,
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
//
|
//
|
||||||
// No hints this time! ;)
|
// No hints this time! ;)
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum Message {
|
enum Message {
|
||||||
// TODO: define a few types of messages as used below
|
// TODO: define a few types of messages as used below
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint enums2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint enums2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum Message {
|
enum Message {
|
||||||
// TODO: define the different variants used below
|
// TODO: define the different variants used below
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint enums3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint enums3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
enum Message {
|
enum Message {
|
||||||
// TODO: implement the message variant types based on their usage below
|
// TODO: implement the message variant types based on their usage below
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint strings1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint strings1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let answer = current_favorite_color();
|
let answer = current_favorite_color();
|
||||||
println!("My current favorite color is {}", answer);
|
println!("My current favorite color is {}", answer);
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint strings2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint strings2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let word = String::from("green"); // Try not changing this line :)
|
let word = String::from("green"); // Try not changing this line :)
|
||||||
if is_a_color_word(word) {
|
if is_a_color_word(word) {
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint strings3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint strings3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn trim_me(input: &str) -> String {
|
fn trim_me(input: &str) -> String {
|
||||||
// TODO: Remove whitespace from both ends of a string!
|
// TODO: Remove whitespace from both ends of a string!
|
||||||
???
|
???
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
//
|
//
|
||||||
// No hints this time!
|
// No hints this time!
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn string_slice(arg: &str) {
|
fn string_slice(arg: &str) {
|
||||||
println!("{}", arg);
|
println!("{}", arg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint modules1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint modules1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
mod sausage_factory {
|
mod sausage_factory {
|
||||||
// Don't let anybody outside of this module see this!
|
// Don't let anybody outside of this module see this!
|
||||||
fn get_secret_recipe() -> String {
|
fn get_secret_recipe() -> String {
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
// Execute `rustlings hint modules2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint modules2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
mod delicious_snacks {
|
mod delicious_snacks {
|
||||||
// TODO: Fix these use statements
|
// TODO: Fix these use statements
|
||||||
use self::fruits::PEAR as ???
|
use self::fruits::PEAR as ???
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// Execute `rustlings hint modules3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint modules3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
// TODO: Complete this use statement
|
// TODO: Complete this use statement
|
||||||
use ???
|
use ???
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// Execute `rustlings hint hashmaps1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint hashmaps1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
fn fruit_basket() -> HashMap<String, u32> {
|
fn fruit_basket() -> HashMap<String, u32> {
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
// Execute `rustlings hint hashmaps2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint hashmaps2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[derive(Hash, PartialEq, Eq)]
|
#[derive(Hash, PartialEq, Eq)]
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
// Execute `rustlings hint hashmaps3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint hashmaps3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
// A structure to store the goal details of a team.
|
// A structure to store the goal details of a team.
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint options1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint options1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
// This function returns how much icecream there is left in the fridge.
|
// This function returns how much icecream there is left in the fridge.
|
||||||
// If it's before 10PM, there's 5 scoops left. At 10PM, someone eats it
|
// If it's before 10PM, there's 5 scoops left. At 10PM, someone eats it
|
||||||
// all, so there'll be no more left :(
|
// all, so there'll be no more left :(
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint options2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint options2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint options3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint options3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
struct Point {
|
struct Point {
|
||||||
x: i32,
|
x: i32,
|
||||||
y: i32,
|
y: i32,
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
// Execute `rustlings hint errors1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint errors1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub fn generate_nametag_text(name: String) -> Option<String> {
|
pub fn generate_nametag_text(name: String) -> Option<String> {
|
||||||
if name.is_empty() {
|
if name.is_empty() {
|
||||||
// Empty names aren't allowed.
|
// Empty names aren't allowed.
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
// Execute `rustlings hint errors2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint errors2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::num::ParseIntError;
|
use std::num::ParseIntError;
|
||||||
|
|
||||||
pub fn total_cost(item_quantity: &str) -> Result<i32, ParseIntError> {
|
pub fn total_cost(item_quantity: &str) -> Result<i32, ParseIntError> {
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
// Execute `rustlings hint errors3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint errors3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::num::ParseIntError;
|
use std::num::ParseIntError;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint errors4` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint errors4` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
struct PositiveNonzeroInteger(u64);
|
struct PositiveNonzeroInteger(u64);
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
// Execute `rustlings hint errors5` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint errors5` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::error;
|
use std::error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::num::ParseIntError;
|
use std::num::ParseIntError;
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
// Execute `rustlings hint errors6` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint errors6` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::num::ParseIntError;
|
use std::num::ParseIntError;
|
||||||
|
|
||||||
// This is a custom error type that we will be using in `parse_pos_nonzero()`.
|
// This is a custom error type that we will be using in `parse_pos_nonzero()`.
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
// Execute `rustlings hint generics1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint generics1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut shopping_list: Vec<?> = Vec::new();
|
let mut shopping_list: Vec<?> = Vec::new();
|
||||||
shopping_list.push("milk");
|
shopping_list.push("milk");
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
// Execute `rustlings hint generics2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint generics2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
struct Wrapper {
|
struct Wrapper {
|
||||||
value: u32,
|
value: u32,
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
// Execute `rustlings hint traits1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint traits1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
trait AppendBar {
|
trait AppendBar {
|
||||||
fn append_bar(self) -> Self;
|
fn append_bar(self) -> Self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint traits2` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint traits2` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
trait AppendBar {
|
trait AppendBar {
|
||||||
fn append_bar(self) -> Self;
|
fn append_bar(self) -> Self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// Execute `rustlings hint traits3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint traits3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub trait Licensed {
|
pub trait Licensed {
|
||||||
fn licensing_info(&self) -> String;
|
fn licensing_info(&self) -> String;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
// Execute `rustlings hint traits4` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint traits4` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub trait Licensed {
|
pub trait Licensed {
|
||||||
fn licensing_info(&self) -> String {
|
fn licensing_info(&self) -> String {
|
||||||
"some information".to_string()
|
"some information".to_string()
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
// Execute `rustlings hint traits5` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint traits5` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub trait SomeTrait {
|
pub trait SomeTrait {
|
||||||
fn some_function(&self) -> bool {
|
fn some_function(&self) -> bool {
|
||||||
true
|
true
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// Execute `rustlings hint lifetimes1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint lifetimes1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn longest(x: &str, y: &str) -> &str {
|
fn longest(x: &str, y: &str) -> &str {
|
||||||
if x.len() > y.len() {
|
if x.len() > y.len() {
|
||||||
x
|
x
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
// Execute `rustlings hint lifetimes2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint lifetimes2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
|
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
|
||||||
if x.len() > y.len() {
|
if x.len() > y.len() {
|
||||||
x
|
x
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint lifetimes3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint lifetimes3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
struct Book {
|
struct Book {
|
||||||
author: &str,
|
author: &str,
|
||||||
title: &str,
|
title: &str,
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
// Execute `rustlings hint tests1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint tests1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
// Execute `rustlings hint tests2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint tests2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
// Execute `rustlings hint tests3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint tests3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub fn is_even(num: i32) -> bool {
|
pub fn is_even(num: i32) -> bool {
|
||||||
num % 2 == 0
|
num % 2 == 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint tests4` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint tests4` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
struct Rectangle {
|
struct Rectangle {
|
||||||
width: i32,
|
width: i32,
|
||||||
height: i32
|
height: i32
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
// Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn main() {
|
fn main() {
|
||||||
let my_fav_fruits = vec!["banana", "custard apple", "avocado", "peach", "raspberry"];
|
let my_fav_fruits = vec!["banana", "custard apple", "avocado", "peach", "raspberry"];
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
// Execute `rustlings hint iterators2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint iterators2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
// Step 1.
|
// Step 1.
|
||||||
// Complete the `capitalize_first` function.
|
// Complete the `capitalize_first` function.
|
||||||
// "hello" -> "Hello"
|
// "hello" -> "Hello"
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
// Execute `rustlings hint iterators3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint iterators3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum DivisionError {
|
pub enum DivisionError {
|
||||||
NotDivisible(NotDivisibleError),
|
NotDivisible(NotDivisibleError),
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint iterators4` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint iterators4` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub fn factorial(num: u64) -> u64 {
|
pub fn factorial(num: u64) -> u64 {
|
||||||
// Complete this function to return the factorial of num
|
// Complete this function to return the factorial of num
|
||||||
// Do not use:
|
// Do not use:
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// Execute `rustlings hint iterators5` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint iterators5` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint arc1` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint arc1` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#![forbid(unused_imports)] // Do not change this, (or the next) line.
|
#![forbid(unused_imports)] // Do not change this, (or the next) line.
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint box1` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint box1` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
pub enum List {
|
pub enum List {
|
||||||
Cons(i32, List),
|
Cons(i32, List),
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint cow1` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint cow1` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
fn abs_all<'a, 'b>(input: &'a mut Cow<'b, [i32]>) -> &'a mut Cow<'b, [i32]> {
|
fn abs_all<'a, 'b>(input: &'a mut Cow<'b, [i32]>) -> &'a mut Cow<'b, [i32]> {
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint rc1` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint rc1` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// Execute `rustlings hint threads1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint threads1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
// Execute `rustlings hint threads2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint threads2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint threads3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint threads3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint macros1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint macros1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
macro_rules! my_macro {
|
macro_rules! my_macro {
|
||||||
() => {
|
() => {
|
||||||
println!("Check out my macro!");
|
println!("Check out my macro!");
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint macros2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint macros2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
my_macro!();
|
my_macro!();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
// Execute `rustlings hint macros3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint macros3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
mod macros {
|
mod macros {
|
||||||
macro_rules! my_macro {
|
macro_rules! my_macro {
|
||||||
() => {
|
() => {
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint macros4` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint macros4` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
macro_rules! my_macro {
|
macro_rules! my_macro {
|
||||||
() => {
|
() => {
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
// Execute `rustlings hint clippy1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint clippy1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
use std::f32;
|
use std::f32;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Execute `rustlings hint clippy2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint clippy2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut res = 42;
|
let mut res = 42;
|
||||||
let option = Some(12);
|
let option = Some(12);
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Here's a couple more easy Clippy fixes, so you can see its utility.
|
// Here's a couple more easy Clippy fixes, so you can see its utility.
|
||||||
// No hints.
|
// No hints.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[allow(unused_variables, unused_assignments)]
|
#[allow(unused_variables, unused_assignments)]
|
||||||
fn main() {
|
fn main() {
|
||||||
let my_option: Option<()> = None;
|
let my_option: Option<()> = None;
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
// Execute `rustlings hint as_ref_mut` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint as_ref_mut` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
// Obtain the number of bytes (not characters) in the given argument.
|
// Obtain the number of bytes (not characters) in the given argument.
|
||||||
// TODO: Add the AsRef trait appropriately as a trait bound.
|
// TODO: Add the AsRef trait appropriately as a trait bound.
|
||||||
fn byte_counter<T>(arg: T) -> usize {
|
fn byte_counter<T>(arg: T) -> usize {
|
||||||
|
|
|
@ -41,8 +41,6 @@ impl Default for Person {
|
||||||
// If while parsing the age, something goes wrong, then return the default of
|
// If while parsing the age, something goes wrong, then return the default of
|
||||||
// Person Otherwise, then return an instantiated Person object with the results
|
// Person Otherwise, then return an instantiated Person object with the results
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
impl From<&str> for Person {
|
impl From<&str> for Person {
|
||||||
fn from(s: &str) -> Person {}
|
fn from(s: &str) -> Person {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,6 @@ enum ParsePersonError {
|
||||||
ParseInt(ParseIntError),
|
ParseInt(ParseIntError),
|
||||||
}
|
}
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
// Steps:
|
// Steps:
|
||||||
// 1. If the length of the provided string is 0, an error should be returned
|
// 1. If the length of the provided string is 0, an error should be returned
|
||||||
// 2. Split the given string on the commas present in it
|
// 2. Split the given string on the commas present in it
|
||||||
|
|
|
@ -27,8 +27,6 @@ enum IntoColorError {
|
||||||
IntConversion,
|
IntConversion,
|
||||||
}
|
}
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
// Your task is to complete this implementation and return an Ok result of inner
|
// Your task is to complete this implementation and return an Ok result of inner
|
||||||
// type Color. You need to create an implementation for a tuple of three
|
// type Color. You need to create an implementation for a tuple of three
|
||||||
// integers, an array of three integers, and a slice of integers.
|
// integers, an array of three integers, and a slice of integers.
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
// Execute `rustlings hint using_as` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint using_as` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn average(values: &[f64]) -> f64 {
|
fn average(values: &[f64]) -> f64 {
|
||||||
let total = values.iter().sum::<f64>();
|
let total = values.iter().sum::<f64>();
|
||||||
total / values.len()
|
total / values.len()
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
//
|
//
|
||||||
// No hints this time ;)
|
// No hints this time ;)
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
// Put your function here!
|
// Put your function here!
|
||||||
// fn calculate_price_of_apples {
|
// fn calculate_price_of_apples {
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
//
|
//
|
||||||
// No hints this time!
|
// No hints this time!
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
Uppercase,
|
Uppercase,
|
||||||
Trim,
|
Trim,
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint quiz3` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint quiz3` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub struct ReportCard {
|
pub struct ReportCard {
|
||||||
pub grade: f32,
|
pub grade: f32,
|
||||||
pub student_name: String,
|
pub student_name: String,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
name = "intro1"
|
name = "intro1"
|
||||||
path = "exercises/00_intro/intro1.rs"
|
path = "exercises/00_intro/intro1.rs"
|
||||||
mode = "compile"
|
mode = "compile"
|
||||||
|
# TODO: Fix hint
|
||||||
hint = """
|
hint = """
|
||||||
Remove the `I AM NOT DONE` comment in the `exercises/intro00/intro1.rs` file
|
Remove the `I AM NOT DONE` comment in the `exercises/intro00/intro1.rs` file
|
||||||
to move on to the next exercise."""
|
to move on to the next exercise."""
|
||||||
|
@ -129,11 +130,7 @@ path = "exercises/02_functions/functions3.rs"
|
||||||
mode = "compile"
|
mode = "compile"
|
||||||
hint = """
|
hint = """
|
||||||
This time, the function *declaration* is okay, but there's something wrong
|
This time, the function *declaration* is okay, but there's something wrong
|
||||||
with the place where we're calling the function.
|
with the place where we're calling the function."""
|
||||||
|
|
||||||
As a reminder, you can freely play around with different solutions in Rustlings!
|
|
||||||
Watch mode will only jump to the next exercise if you remove the `I AM NOT
|
|
||||||
DONE` comment."""
|
|
||||||
|
|
||||||
[[exercises]]
|
[[exercises]]
|
||||||
name = "functions4"
|
name = "functions4"
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue