mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Forbid uses of unwrap() in the code (#7795)
This commit is contained in:
@@ -791,6 +791,7 @@ impl Frame {
|
||||
/// This function will take the ownership of your [`glow::Texture`], so please do not delete your [`glow::Texture`] after registering.
|
||||
#[cfg(all(feature = "glow", not(target_arch = "wasm32")))]
|
||||
pub fn register_native_glow_texture(&mut self, native: glow::Texture) -> egui::TextureId {
|
||||
#[expect(clippy::unwrap_used)]
|
||||
self.glow_register_native_texture.as_mut().unwrap()(native)
|
||||
}
|
||||
|
||||
|
||||
@@ -376,6 +376,7 @@ impl EpiIntegration {
|
||||
|
||||
fn load_default_egui_icon() -> egui::IconData {
|
||||
profiling::function_scope!();
|
||||
#[expect(clippy::unwrap_used)]
|
||||
crate::icon_data::from_png_bytes(&include_bytes!("../../data/icon.png")[..]).unwrap()
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
//! There is a bunch of improvements we could do,
|
||||
//! like removing a bunch of `unwraps`.
|
||||
|
||||
#![allow(clippy::undocumented_unsafe_blocks)]
|
||||
#![expect(clippy::undocumented_unsafe_blocks)]
|
||||
#![expect(clippy::unwrap_used)]
|
||||
|
||||
use std::{cell::RefCell, num::NonZeroU32, rc::Rc, sync::Arc, time::Instant};
|
||||
|
||||
|
||||
@@ -27,7 +27,10 @@ pub fn create_egui_context(storage: Option<&dyn crate::Storage>) -> egui::Contex
|
||||
|
||||
egui_ctx.options_mut(|o| {
|
||||
// eframe supports multi-pass (Context::request_discard).
|
||||
o.max_passes = 2.try_into().unwrap();
|
||||
#[expect(clippy::unwrap_used)]
|
||||
{
|
||||
o.max_passes = 2.try_into().unwrap();
|
||||
}
|
||||
});
|
||||
|
||||
let memory = crate::native::epi_integration::load_egui_memory(storage).unwrap_or_default();
|
||||
|
||||
@@ -23,7 +23,7 @@ impl Stopwatch {
|
||||
}
|
||||
|
||||
pub fn pause(&mut self) {
|
||||
let start = self.start.take().unwrap();
|
||||
let start = self.start.take().expect("Stopwatch is not running");
|
||||
let duration = start.elapsed();
|
||||
self.total_time_ns += duration.as_nanos();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//! [`egui`] bindings for web apps (compiling to WASM).
|
||||
|
||||
#![allow(clippy::missing_errors_doc)] // So many `-> Result<_, JsValue>`
|
||||
#![expect(clippy::missing_errors_doc)] // So many `-> Result<_, JsValue>`
|
||||
#![expect(clippy::unwrap_used)] // TODO(emilk): remove unwraps
|
||||
|
||||
mod app_runner;
|
||||
mod backend;
|
||||
|
||||
Reference in New Issue
Block a user