The following code works fine locally, but the codewars will report the same error as below
CODE:
fn accum(Str: &str) -> String {
let mut cnt = 0;
let Strlen = Str.len();
Str.chars().fold("".to_string(), |res, item| {
cnt += 1;
res + &item.to_uppercase().to_string() + &item.to_string().repeat(cnt-1) + if cnt < Strlen {"-"} else {""}})
}
ERROR:
error: no method named to_string
found for type std::char::ToUppercase
in the current scope
--> src/lib.rs:6:36
|
6 | res + &item.to_uppercase().to_string() + &item.to_string().repeat(cnt-1) + if cnt < Strlen {"-"} else {""}})
| ^^^^^^^^^
|
= note: the method to_string
exists but the following trait bounds were not satisfied: std::char::ToUppercase : std::fmt::Display
error: use of unstable library feature 'repeat_str' (see issue #37079)
--> src/lib.rs:6:68
|
6 | res + &item.to_uppercase().to_string() + &item.to_string().repeat(cnt-1) + if cnt < Strlen {"-"} else {""}})
| ^^^^^^
error: aborting due to 2 previous errors