mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-26 00:00:03 +03:00
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.
This commit is contained in:
parent
4868d18ea3
commit
5812f1f27b
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
pub fn fizz_if_foo(fizzish: &str) -> &str {
|
pub fn foo_if_fizz(fizzish: &str) -> &str {
|
||||||
if fizzish == "fizz" {
|
if fizzish == "fizz" {
|
||||||
"foo"
|
"foo"
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,16 +21,16 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn foo_for_fizz() {
|
fn foo_for_fizz() {
|
||||||
assert_eq!(fizz_if_foo("fizz"), "foo")
|
assert_eq!(foo_if_fizz("fizz"), "foo")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bar_for_fuzz() {
|
fn bar_for_fuzz() {
|
||||||
assert_eq!(fizz_if_foo("fuzz"), "bar")
|
assert_eq!(foo_if_fizz("fuzz"), "bar")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn default_to_baz() {
|
fn default_to_baz() {
|
||||||
assert_eq!(fizz_if_foo("literally anything"), "baz")
|
assert_eq!(foo_if_fizz("literally anything"), "baz")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue