summaryrefslogtreecommitdiff
path: root/exercises
diff options
context:
space:
mode:
authorAdam Sherwood <theherk@gmail.com>2022-02-20 16:15:56 +0100
committermokou <mokou@fastmail.com>2022-07-12 11:13:04 +0200
commit5812f1f27b0e3c2eed6e4606635bb810d0a5727e (patch)
tree4e2514e0b689c640bc135d287cd592490db324a0 /exercises
parent4868d18ea315f15ad007086f218c8a1ee68a8eb4 (diff)
fix(if2): Rename if2 exercise function to foo_if_fizz.
The reasoning here is pretty straightforward: you don't say "Hungry, if eat." That doesn't make sense. We want to get "foo" back if given "fizz", so it seems this makes far more sense as "Eat, if hungry," or in this case, return `foo_if_fizz` is given.
Diffstat (limited to 'exercises')
-rw-r--r--exercises/if/if2.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/exercises/if/if2.rs b/exercises/if/if2.rs
index 6fed6f8..effddbb 100644
--- a/exercises/if/if2.rs
+++ b/exercises/if/if2.rs
@@ -6,7 +6,7 @@
// I AM NOT DONE
-pub fn fizz_if_foo(fizzish: &str) -> &str {
+pub fn foo_if_fizz(fizzish: &str) -> &str {
if fizzish == "fizz" {
"foo"
} else {
@@ -21,16 +21,16 @@ mod tests {
#[test]
fn foo_for_fizz() {
- assert_eq!(fizz_if_foo("fizz"), "foo")
+ assert_eq!(foo_if_fizz("fizz"), "foo")
}
#[test]
fn bar_for_fuzz() {
- assert_eq!(fizz_if_foo("fuzz"), "bar")
+ assert_eq!(foo_if_fizz("fuzz"), "bar")
}
#[test]
fn default_to_baz() {
- assert_eq!(fizz_if_foo("literally anything"), "baz")
+ assert_eq!(foo_if_fizz("literally anything"), "baz")
}
}