@@ -96,7 +96,7 @@ impl GlContext {
9696
9797 errors:: XErrorHandler :: handle ( display, |error_handler| {
9898 #[ allow( non_snake_case) ]
99- let glXCreateContextAttribsARB: GlXCreateContextAttribsARB = unsafe {
99+ let glXCreateContextAttribsARB: GlXCreateContextAttribsARB = {
100100 let addr = get_proc_address ( "glXCreateContextAttribsARB" ) ;
101101 if addr. is_null ( ) {
102102 return Err ( GlError :: CreationFailed ( CreationFailedError :: GetProcAddressFailed ) ) ;
@@ -106,7 +106,7 @@ impl GlContext {
106106 } ;
107107
108108 #[ allow( non_snake_case) ]
109- let glXSwapIntervalEXT: GlXSwapIntervalEXT = unsafe {
109+ let glXSwapIntervalEXT: GlXSwapIntervalEXT = {
110110 let addr = get_proc_address ( "glXSwapIntervalEXT" ) ;
111111 if addr. is_null ( ) {
112112 return Err ( GlError :: CreationFailed ( CreationFailedError :: GetProcAddressFailed ) ) ;
@@ -130,36 +130,32 @@ impl GlContext {
130130 0 ,
131131 ] ;
132132
133- let context = unsafe {
134- glXCreateContextAttribsARB (
135- display,
136- config. fb_config ,
137- std:: ptr:: null_mut ( ) ,
138- 1 ,
139- ctx_attribs. as_ptr ( ) ,
140- )
141- } ;
133+ let context = glXCreateContextAttribsARB (
134+ display,
135+ config. fb_config ,
136+ std:: ptr:: null_mut ( ) ,
137+ 1 ,
138+ ctx_attribs. as_ptr ( ) ,
139+ ) ;
142140
143141 error_handler. check ( ) ?;
144142
145143 if context. is_null ( ) {
146144 return Err ( GlError :: CreationFailed ( CreationFailedError :: ContextCreationFailed ) ) ;
147145 }
148146
149- unsafe {
150- let res = glx:: glXMakeCurrent ( display, handle. window , context) ;
151- error_handler. check ( ) ?;
152- if res == 0 {
153- return Err ( GlError :: CreationFailed ( CreationFailedError :: MakeCurrentFailed ) ) ;
154- }
147+ let res = glx:: glXMakeCurrent ( display, handle. window , context) ;
148+ error_handler. check ( ) ?;
149+ if res == 0 {
150+ return Err ( GlError :: CreationFailed ( CreationFailedError :: MakeCurrentFailed ) ) ;
151+ }
155152
156- glXSwapIntervalEXT ( display, handle. window , config. gl_config . vsync as i32 ) ;
157- error_handler. check ( ) ?;
153+ glXSwapIntervalEXT ( display, handle. window , config. gl_config . vsync as i32 ) ;
154+ error_handler. check ( ) ?;
158155
159- if glx:: glXMakeCurrent ( display, 0 , std:: ptr:: null_mut ( ) ) == 0 {
160- error_handler. check ( ) ?;
161- return Err ( GlError :: CreationFailed ( CreationFailedError :: MakeCurrentFailed ) ) ;
162- }
156+ if glx:: glXMakeCurrent ( display, 0 , std:: ptr:: null_mut ( ) ) == 0 {
157+ error_handler. check ( ) ?;
158+ return Err ( GlError :: CreationFailed ( CreationFailedError :: MakeCurrentFailed ) ) ;
163159 }
164160
165161 Ok ( GlContext { window : handle. window , display, context } )
@@ -173,7 +169,7 @@ impl GlContext {
173169 display : * mut xlib:: _XDisplay , config : GlConfig ,
174170 ) -> Result < ( FbConfig , WindowConfig ) , GlError > {
175171 errors:: XErrorHandler :: handle ( display, |error_handler| {
176- let screen = unsafe { xlib:: XDefaultScreen ( display) } ;
172+ let screen = xlib:: XDefaultScreen ( display) ;
177173
178174 #[ rustfmt:: skip]
179175 let fb_attribs = [
@@ -195,9 +191,8 @@ impl GlContext {
195191 ] ;
196192
197193 let mut n_configs = 0 ;
198- let fb_config = unsafe {
199- glx:: glXChooseFBConfig ( display, screen, fb_attribs. as_ptr ( ) , & mut n_configs)
200- } ;
194+ let fb_config =
195+ glx:: glXChooseFBConfig ( display, screen, fb_attribs. as_ptr ( ) , & mut n_configs) ;
201196
202197 error_handler. check ( ) ?;
203198 if n_configs <= 0 || fb_config. is_null ( ) {
0 commit comments