Does exceeding unwrapping affect a perfomance?
⚓ Rust 📅 2025-09-10 👤 surdeus 👁️ 9I 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
🏷️ Rust_feed