From ce30485458f1c1cd2b9de9c44c10f0fee1540152 Mon Sep 17 00:00:00 2001 From: Manuel Gil <manugildev@gmail.com> Date: Sun, 1 Mar 2020 09:29:14 +0000 Subject: [PATCH] Solve strings --- exercises/strings/strings1.rs | 8 +++----- exercises/strings/strings2.rs | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/exercises/strings/strings1.rs b/exercises/strings/strings1.rs index 8090244..1c9f4bc 100644 --- a/exercises/strings/strings1.rs +++ b/exercises/strings/strings1.rs @@ -2,13 +2,11 @@ // Make me compile without changing the function signature! // Execute `rustlings hint strings1` for hints ;) -// I AM NOT DONE - -fn main() { +pub fn main() { let answer = current_favorite_color(); println!("My current favorite color is {}", answer); } -fn current_favorite_color() -> String { - "blue" +pub fn current_favorite_color() -> String { + return String::from("blue"); } diff --git a/exercises/strings/strings2.rs b/exercises/strings/strings2.rs index 5a2ce74..a048f88 100644 --- a/exercises/strings/strings2.rs +++ b/exercises/strings/strings2.rs @@ -2,11 +2,9 @@ // Make me compile without changing the function signature! // Execute `rustlings hint strings2` for hints :) -// I AM NOT DONE - fn main() { let word = String::from("green"); // Try not changing this line :) - if is_a_color_word(word) { + if is_a_color_word(&word) { println!("That is a color word I know!"); } else { println!("That is not a color word I know.");