Skip to content

Commit

Permalink
fist rust warnings & bypassed is_active implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Oct 5, 2024
1 parent 18daca2 commit d64fd81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ use std::{ffi::c_void, fmt, time::Duration};

#[cfg(target_arch = "wasm32")]
use std::panic;
#[cfg(target_arch = "wasm32")]
use web_sys::HtmlElement;

#[cfg(target_os = "macos")]
use os::macos as imp;
Expand Down
12 changes: 6 additions & 6 deletions src/os/wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl Window {
closure.forget();
}

let mut window = Window {
Ok(Window {
width: width as u32,
height: height as u32,
bg_color: 0,
Expand All @@ -196,9 +196,7 @@ impl Window {
menu_counter: MenuHandle(0),
menus: Vec::new(),
raw_handle_id,
};

Ok(window)
})
}

fn create_2d_context(&self) -> CanvasRenderingContext2d {
Expand Down Expand Up @@ -426,8 +424,10 @@ impl Window {

#[inline]
pub fn is_active(&mut self) -> bool {
let document = window().unwrap().document().unwrap();
document.active_element().unwrap_or(return false) == **self.canvas
window()
.and_then(|window| window.document())
.and_then(|document| document.active_element())
.map_or(false, |element| element == **self.canvas)
}

#[inline]
Expand Down
2 changes: 2 additions & 0 deletions src/rate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ use instant::{Duration, Instant};
#[cfg(not(target_arch = "wasm32"))]
use std::time::{Duration, Instant};

#[cfg_attr(target_arch = "wasm32", allow(unused))]
pub struct UpdateRate {
target_rate: Option<Duration>,
prev_time: Instant,
}

#[cfg_attr(target_arch = "wasm32", allow(unused))]
impl UpdateRate {
pub fn new() -> UpdateRate {
UpdateRate {
Expand Down

0 comments on commit d64fd81

Please sign in to comment.