1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-11-27 22:38:18 +02:00

add tests; refactor exercise links

This commit is contained in:
liv
2019-01-23 20:48:01 +01:00
parent 141db7795b
commit dc1f3b79f8
11 changed files with 51 additions and 26 deletions

View File

@@ -1,21 +0,0 @@
// 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`
// before the parentheses on each line. If you're right, it will compile!
fn string_slice(arg: &str) { println!("{}", arg); }
fn string(arg: String) { println!("{}", arg); }
fn main() {
("blue");
("red".to_string());
(String::from("hi"));
("rust is fun!".to_owned());
("nice weather".into());
(format!("Interpolation {}", "Station"));
(&String::from("abc")[0..1]);
(" hello there ".trim());
("Happy Monday!".to_string().replace("Mon", "Tues"));
("mY sHiFt KeY iS sTiCkY".to_lowercase());
}