mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-22 14:02:22 -05:00
chore(errors1): use is_empty()
instead of len() > 0
more idiomatic according to clippy
This commit is contained in:
parent
b71feed824
commit
582320aded
1 changed files with 3 additions and 3 deletions
|
@ -8,11 +8,11 @@
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
pub fn generate_nametag_text(name: String) -> Option<String> {
|
pub fn generate_nametag_text(name: String) -> Option<String> {
|
||||||
if name.len() > 0 {
|
if name.is_empty() {
|
||||||
Some(format!("Hi! My name is {}", name))
|
|
||||||
} else {
|
|
||||||
// Empty names aren't allowed.
|
// Empty names aren't allowed.
|
||||||
None
|
None
|
||||||
|
} else {
|
||||||
|
Some(format!("Hi! My name is {}", name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue