diff --git a/crates/eframe/src/lib.rs b/crates/eframe/src/lib.rs index 9f9f3a4c807..4e3ebad1dfe 100644 --- a/crates/eframe/src/lib.rs +++ b/crates/eframe/src/lib.rs @@ -197,7 +197,7 @@ pub mod icon_data; /// ``` no_run /// use eframe::egui; /// -/// fn main() -> eframe::Result<()> { +/// fn main() -> eframe::Result { /// let native_options = eframe::NativeOptions::default(); /// eframe::run_native("MyApp", native_options, Box::new(|cc| Ok(Box::new(MyEguiApp::new(cc))))) /// } @@ -233,7 +233,7 @@ pub fn run_native( app_name: &str, mut native_options: NativeOptions, app_creator: AppCreator, -) -> Result<()> { +) -> Result { #[cfg(not(feature = "__screenshot"))] assert!( std::env::var("EFRAME_SCREENSHOT_TO").is_err(), @@ -278,7 +278,7 @@ pub fn run_native( /// /// # Example /// ``` no_run -/// fn main() -> eframe::Result<()> { +/// fn main() -> eframe::Result { /// // Our application state: /// let mut name = "Arthur".to_owned(); /// let mut age = 42; @@ -310,7 +310,7 @@ pub fn run_simple_native( app_name: &str, native_options: NativeOptions, update_fun: impl FnMut(&egui::Context, &mut Frame) + 'static, -) -> Result<()> { +) -> Result { struct SimpleApp { update_fun: U, } @@ -445,7 +445,7 @@ impl std::fmt::Display for Error { } /// Short for `Result`. -pub type Result = std::result::Result; +pub type Result = std::result::Result; // --------------------------------------------------------------------------- diff --git a/crates/eframe/src/native/glow_integration.rs b/crates/eframe/src/native/glow_integration.rs index 67fcd71471a..13576bdbd2d 100644 --- a/crates/eframe/src/native/glow_integration.rs +++ b/crates/eframe/src/native/glow_integration.rs @@ -1088,7 +1088,7 @@ impl GlutinWindowContext { &mut self, viewport_id: ViewportId, event_loop: &EventLoopWindowTarget, - ) -> Result<()> { + ) -> Result { crate::profile_function!(); let viewport = self @@ -1188,7 +1188,7 @@ impl GlutinWindowContext { } /// only applies for android. but we basically drop surface + window and make context not current - fn on_suspend(&mut self) -> Result<()> { + fn on_suspend(&mut self) -> Result { log::debug!("received suspend event. dropping window and surface"); for viewport in self.viewports.values_mut() { viewport.gl_surface = None; diff --git a/crates/eframe/src/native/run.rs b/crates/eframe/src/native/run.rs index 7087ed6ae71..6ba5486b678 100644 --- a/crates/eframe/src/native/run.rs +++ b/crates/eframe/src/native/run.rs @@ -60,10 +60,7 @@ fn with_event_loop( } #[cfg(not(target_os = "ios"))] -fn run_and_return( - event_loop: &mut EventLoop, - mut winit_app: impl WinitApp, -) -> Result<()> { +fn run_and_return(event_loop: &mut EventLoop, mut winit_app: impl WinitApp) -> Result { use winit::{event_loop::ControlFlow, platform::run_on_demand::EventLoopExtRunOnDemand}; log::trace!("Entering the winit event loop (run_on_demand)…"); @@ -234,7 +231,7 @@ fn run_and_return( fn run_and_exit( event_loop: EventLoop, mut winit_app: impl WinitApp + 'static, -) -> Result<()> { +) -> Result { use winit::event_loop::ControlFlow; log::trace!("Entering the winit event loop (run)…"); @@ -390,7 +387,7 @@ pub fn run_glow( app_name: &str, mut native_options: epi::NativeOptions, app_creator: epi::AppCreator, -) -> Result<()> { +) -> Result { #![allow(clippy::needless_return_with_question_mark)] // False positive use super::glow_integration::GlowWinitApp; @@ -415,7 +412,7 @@ pub fn run_wgpu( app_name: &str, mut native_options: epi::NativeOptions, app_creator: epi::AppCreator, -) -> Result<()> { +) -> Result { #![allow(clippy::needless_return_with_question_mark)] // False positive use super::wgpu_integration::WgpuWinitApp; diff --git a/examples/user_attention/src/main.rs b/examples/user_attention/src/main.rs index 53c170a1144..3d171c279e8 100644 --- a/examples/user_attention/src/main.rs +++ b/examples/user_attention/src/main.rs @@ -6,7 +6,7 @@ use egui::{Button, CentralPanel, Context, UserAttentionType}; use std::time::{Duration, SystemTime}; -fn main() -> eframe::Result<()> { +fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). let native_options = NativeOptions { viewport: egui::ViewportBuilder::default().with_inner_size([400., 200.]), diff --git a/tests/test_size_pass/src/main.rs b/tests/test_size_pass/src/main.rs index ab9ad17e500..0376868b279 100644 --- a/tests/test_size_pass/src/main.rs +++ b/tests/test_size_pass/src/main.rs @@ -3,7 +3,7 @@ use eframe::egui; -fn main() -> eframe::Result<()> { +fn main() -> eframe::Result { env_logger::init(); // Use `RUST_LOG=debug` to see logs. let options = eframe::NativeOptions::default();