mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-01 16:03:31 +02:00
chore(errors1): use is_empty() instead of len() > 0
more idiomatic according to clippy
This commit is contained in:
committed by
mokou
co-authored by
mokou
parent
b71feed824
commit
582320aded
@@ -8,11 +8,11 @@
|
||||
// I AM NOT DONE
|
||||
|
||||
pub fn generate_nametag_text(name: String) -> Option<String> {
|
||||
if name.len() > 0 {
|
||||
Some(format!("Hi! My name is {}", name))
|
||||
} else {
|
||||
if name.is_empty() {
|
||||
// Empty names aren't allowed.
|
||||
None
|
||||
} else {
|
||||
Some(format!("Hi! My name is {}", name))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user