11pub mod error;
22pub mod render;
33
4- use std:: { cell:: RefCell , ffi :: c_void , num:: NonZero , ptr:: NonNull , sync:: OnceLock } ;
4+ use std:: { cell:: RefCell , num:: NonZero , ptr:: NonNull , sync:: OnceLock } ;
55
66use bevy:: {
77 app:: { App , AppExit } ,
@@ -27,7 +27,7 @@ use crate::{
2727static IS_INIT : OnceLock < ( ) > = OnceLock :: new ( ) ;
2828
2929thread_local ! {
30- static APP : RefCell <Option <App >> = RefCell :: new( None ) ;
30+ static APP : RefCell <Option <App >> = const { RefCell :: new( None ) } ;
3131}
3232
3333#[ derive( Resource , Default ) ]
@@ -112,7 +112,7 @@ fn app<T>(cb: impl FnOnce(&App) -> Result<T>) -> Result<T> {
112112 let app_borrow = app_cell. borrow ( ) ;
113113 let app = app_borrow
114114 . as_ref ( )
115- . ok_or_else ( || error:: ProcessingError :: AppAccess ) ?;
115+ . ok_or ( error:: ProcessingError :: AppAccess ) ?;
116116 cb ( app)
117117 } ) ?;
118118 Ok ( res)
@@ -123,7 +123,7 @@ fn app_mut<T>(cb: impl FnOnce(&mut App) -> Result<T>) -> Result<T> {
123123 let mut app_borrow = app_cell. borrow_mut ( ) ;
124124 let app = app_borrow
125125 . as_mut ( )
126- . ok_or_else ( || error:: ProcessingError :: AppAccess ) ?;
126+ . ok_or ( error:: ProcessingError :: AppAccess ) ?;
127127 cb ( app)
128128 } ) ?;
129129 Ok ( res)
@@ -196,8 +196,8 @@ pub fn create_surface(
196196
197197 match content_view {
198198 Some ( view) => {
199- let view_ptr = Retained :: as_ptr ( & view ) as * mut std :: ffi :: c_void ;
200- view_ptr
199+
200+ Retained :: as_ptr ( & view ) as * mut std :: ffi :: c_void
201201 }
202202 None => {
203203 return Err ( error:: ProcessingError :: InvalidWindowHandle ) ;
@@ -491,7 +491,7 @@ pub fn exit(exit_code: u8) -> Result<()> {
491491pub fn background_color ( window_entity : Entity , color : Color ) -> Result < ( ) > {
492492 app_mut ( |app| {
493493 let mut camera_query = app. world_mut ( ) . query :: < ( & mut Camera , & ChildOf ) > ( ) ;
494- for ( mut camera, parent) in camera_query. iter_mut ( & mut app. world_mut ( ) ) {
494+ for ( mut camera, parent) in camera_query. iter_mut ( app. world_mut ( ) ) {
495495 if parent. parent ( ) == window_entity {
496496 camera. clear_color = ClearColorConfig :: Custom ( color) ;
497497 }
0 commit comments