builtin: cleanup u8.repeat() and rune.repeat() (#22100)

This commit is contained in:
yuyi 2024-08-23 13:24:35 +08:00 committed by GitHub
parent e3ceb5881a
commit 971feb8f89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 18 deletions

View file

@ -10,9 +10,7 @@ pub fn (ra []rune) string() string {
}
pub fn (c rune) repeat(count int) string {
if count < 0 {
panic('rune.repeat: count is negative: ${count}')
} else if count == 0 {
if count <= 0 {
return ''
} else if count == 1 {
return c.str()