remove the ex*.rs files
This commit is contained in:
parent
ed89ada148
commit
b90f642029
47
ex6.rs
47
ex6.rs
|
@ -1,47 +0,0 @@
|
|||
// ex6.rs
|
||||
// Make me compile! Scroll down for hints :)
|
||||
|
||||
fn main() {
|
||||
let robot_name = Some(String::from("Bors"));
|
||||
|
||||
match robot_name {
|
||||
Some(name) => println!("Found a name: {}", name),
|
||||
None => (),
|
||||
}
|
||||
|
||||
println!("robot_name is: {:?}", robot_name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Hint: The following two statements are equivalent:
|
||||
// let x = &y;
|
||||
// let ref x = y;
|
|
@ -1,6 +0,0 @@
|
|||
// ex1.rs
|
||||
// Make me compile! :)
|
||||
|
||||
fn main() {
|
||||
println();
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// ex2.rs
|
||||
// Make me compile!
|
||||
|
||||
fn something() -> String {
|
||||
"hi!"
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("{}", something());
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// ex3.rs
|
||||
// Make me compile!
|
||||
|
||||
struct Foo {
|
||||
capacity: i32,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("{:?}", Foo { capacity: 3 });
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
// ex4.rs
|
||||
// Make me compile!
|
||||
|
||||
fn something() -> Result<i32, std::num::ParseIntError> {
|
||||
let x:i32 = "3".parse();
|
||||
Ok(x * 4)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
match something() {
|
||||
Ok(..) => println!("You win!"),
|
||||
Err(e) => println!("Oh no something went wrong: {}", e),
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
// ex5.rs
|
||||
// Make me compile!
|
||||
|
||||
enum Reaction<'a> {
|
||||
Sad(&'a str),
|
||||
Happy(&'a str),
|
||||
}
|
||||
|
||||
fn express(sentiment: Reaction) {
|
||||
match sentiment {
|
||||
Reaction::Sad(s) => println!(":( {}", s),
|
||||
Reaction::Happy(s) => println!(":) {}", s),
|
||||
}
|
||||
}
|
||||
|
||||
fn main () {
|
||||
let x = Reaction::Happy("It's a great day for Rust!");
|
||||
express(x);
|
||||
express(x);
|
||||
let y = Reaction::Sad("This code doesn't compile yet.");
|
||||
express(y);
|
||||
}
|
|
@ -4,11 +4,6 @@ use indicatif::ProgressBar;
|
|||
use std::process::Command;
|
||||
|
||||
pub fn verify() -> Result<(), ()> {
|
||||
compile_only("exercises/ex1.rs")?;
|
||||
compile_only("exercises/ex2.rs")?;
|
||||
compile_only("exercises/ex3.rs")?;
|
||||
compile_only("exercises/ex4.rs")?;
|
||||
compile_only("exercises/ex5.rs")?;
|
||||
compile_only("exercises/variables/variables1.rs")?;
|
||||
compile_only("exercises/variables/variables2.rs")?;
|
||||
compile_only("exercises/variables/variables3.rs")?;
|
||||
|
|
Loading…
Reference in New Issue