Comment

Comment by mastax

Pretty deep in the nitpicky weeds here but I don't like putting mut bindings in parameters. They only affect the body of the function but they show up in the interface, including rustdoc, which can be confusing. It's easy to think that

    fn foo(x: u32) {}
    fn foo(mut x: u32) {}
has a semantic difference to the consumer similar to

    fn foo(x: &u32) {}
    fn foo(x: &mut u32) {}
but it does not. To avoid this confusion I'd rather do

    fn foo(x: u32) { let mut x = x; }
parent mastax 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton