Run clippy on CI

Fixes #1402.
This commit is contained in:
Kirill Chibisov 2022-06-10 13:43:33 +03:00 committed by GitHub
parent 57981b533d
commit 10419ff441
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 377 additions and 312 deletions

View file

@ -44,11 +44,11 @@ impl Canvas {
Some(canvas) => canvas,
None => {
let window = web_sys::window()
.ok_or(os_error!(OsError("Failed to obtain window".to_owned())))?;
.ok_or_else(|| os_error!(OsError("Failed to obtain window".to_owned())))?;
let document = window
.document()
.ok_or(os_error!(OsError("Failed to obtain document".to_owned())))?;
.ok_or_else(|| os_error!(OsError("Failed to obtain document".to_owned())))?;
document
.create_element("canvas")
@ -94,10 +94,10 @@ impl Canvas {
self.raw().request_pointer_lock();
} else {
let window = web_sys::window()
.ok_or(os_error!(OsError("Failed to obtain window".to_owned())))?;
.ok_or_else(|| os_error!(OsError("Failed to obtain window".to_owned())))?;
let document = window
.document()
.ok_or(os_error!(OsError("Failed to obtain document".to_owned())))?;
.ok_or_else(|| os_error!(OsError("Failed to obtain document".to_owned())))?;
document.exit_pointer_lock();
}
Ok(())
@ -107,7 +107,7 @@ impl Canvas {
self.common
.raw
.set_attribute(attribute, value)
.expect(&format!("Set attribute: {}", attribute));
.unwrap_or_else(|err| panic!("error: {:?}\nSet attribute: {}", err, attribute))
}
pub fn position(&self) -> LogicalPosition<f64> {
@ -339,9 +339,7 @@ impl Common {
handler(event);
}) as Box<dyn FnMut(E)>);
let listener = EventListenerHandle::new(&self.raw, event_name, closure);
listener
EventListenerHandle::new(&self.raw, event_name, closure)
}
// The difference between add_event and add_user_event is that the latter has a special meaning