Thread with 6 posts

jump to expanded post

When I need to find a minimum time, minimum screen co-ordinate, etc, I often find myself writing Rust code like this:

if let Some(new) = new {
    current = Some(current.map(|i| i.min(new)).unwrap_or(new));
}

Is there a better way to do this? Even if it just covers the inner part (the case where new.is_some()), I’d love to know.

Open thread at this post