#Get rid of clone inside .then_some(val.clone()).ok_or(Err(val))
10 messages · Page 1 of 1 (latest)
Yeah, I just thought about that
I thought too much about complex solutions and didn't realize it's actually easy lol
then_some was a mistake 
why does that function take ownership of val though? I feel like it might be simpler if it just accepted an &str…
Don't I need ownership if I want to create the Error Enum? Otherwise I would have to clone the &str when I create the NumMissing Error
that’s true. I usually don’t worry about cloning on errors because it’s normally a cold path anyway
Makes sense
but if it is hot, then consider taking ownership overall
Nah, you're right