Ancestors

Toot

Written by seri on 2024-08-24 at 20:33

Without checking, at opt-level=3, which of these will optimize away the unwrap, as max will always return Some when used with a non-zero-length array?

pub fn fna(x: [u8; 1024]) -> u8 {
    x.into_iter().max().unwrap()
}

pub fn fnb(x: [u8; 1024]) -> u8 {
    *x.iter().max().unwrap()
}

[#]rust #rustlang

=> More informations about this toot | More toots from seri@hachyderm.io

Descendants

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113018904739262667
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
257.040124 milliseconds
Gemini-to-HTML Time
0.434001 milliseconds

This content has been proxied by September (ba2dc).