Clippy error: mut required for push_str

⚓ Rust    📅 2025-08-30    👤 surdeus    👁️ 3      

surdeus

fn push_fn_err(s :&str)->String{
    s.to_string().push_str("new_chunk");
    s.to_string()
}
fn push_str_expect(s:&str)->String{
    let mut output = s.to_string();
    output.push_str("new_chunk");
    output.to_string()
}
fn main() {
   assert_eq!(push_fn_err(""),push_str_expect("")) ;
}

3 posts - 2 participants

Read full topic

🏷️ Rust_feed