Does exceeding unwrapping affect a perfomance?

⚓ Rust    📅 2025-09-10    👤 surdeus    👁️ 9      

surdeus

Warning

This post was published 63 days ago. The information described in this article may have changed.

I needed a method like is_executable, so I went to crates.io and discovered a magic crate for that. However Windows implementation was questionable for my needs and I simplified it. However my implementation has too many unwraps:

metadata.is_dir() || (self.extension().is_some() &&
              (self.extension().unwrap() == "exe" || self.extension().unwrap() == "bat"))

Should I worry about that, or Rust compiler is smart enough and will eliminate the extra unwrapping? How would you implemented the code?

3 posts - 3 participants

Read full topic

🏷️ Rust_feed