ggez / good-web-game

An alternative ggez implementation on top of miniquad.
MIT License
332 stars 30 forks source link

warning: unnecessary `unsafe` block #24

Closed canadaduane closed 4 years ago

canadaduane commented 4 years ago

Can these unsafe calls be removed? (I'd be happy to PR):

warning: unnecessary `unsafe` block
  --> src/lib.rs:30:21
   |
30 |             let r = unsafe { rand() } as f32 / miniquad::RAND_MAX as f32;
   |                     ^^^^^^ unnecessary `unsafe` block
   |
   = note: `#[warn(unused_unsafe)]` on by default

warning: unnecessary `unsafe` block
  --> src/lib.rs:36:21
   |
36 |             let r = unsafe { rand() } as f32 / miniquad::RAND_MAX as f32;
   |                     ^^^^^^ unnecessary `unsafe` block

warning: unnecessary `unsafe` block
  --> src/lib.rs:43:21
   |
43 |             let r = unsafe { rand() } as f32 / miniquad::RAND_MAX as f32;
   |                     ^^^^^^ unnecessary `unsafe` block
not-fl3 commented 4 years ago

Oh, such a shame, there are #![allow(warnings)] in both repos. If you want - go ahead with PR returning warnings back! :)

not-fl3 commented 4 years ago

For rand - better mark webgl's rand as unsafe - because it is unsafe on linux and windows.