Fix CI warnings (#1898)

* Fix CI warnings

* Use the panic! macro rather than format! + panic_any
This commit is contained in:
Markus Røyset 2021-03-30 21:27:32 +02:00 committed by GitHub
parent 0d634a0061
commit ca9c05368e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 9 additions and 6 deletions

View file

@ -133,7 +133,7 @@ pub trait WindowBuilderExtWindows {
/// `COINIT_APARTMENTTHREADED`) on the same thread. Note that winit may still attempt to initialize
/// COM API regardless of this option. Currently only fullscreen mode does that, but there may be more in the future.
/// If you need COM API with `COINIT_MULTITHREADED` you must initialize it before calling any winit functions.
/// See https://docs.microsoft.com/en-us/windows/win32/api/objbase/nf-objbase-coinitialize#remarks for more information.
/// See <https://docs.microsoft.com/en-us/windows/win32/api/objbase/nf-objbase-coinitialize#remarks> for more information.
fn with_drag_and_drop(self, flag: bool) -> WindowBuilder;
/// Forces a theme or uses the system settings if `None` was provided.

View file

@ -245,6 +245,7 @@ impl<T: 'static> EventLoop<T> {
KeyAction::Up => event::ElementState::Released,
_ => event::ElementState::Released,
};
#[allow(deprecated)]
let event = event::Event::WindowEvent {
window_id,
event: event::WindowEvent::KeyboardInput {

View file

@ -609,11 +609,10 @@ impl<T: 'static> EventLoop<T> {
#[cfg(not(feature = "x11"))]
let x11_err = "backend disabled";
let err_string = format!(
panic!(
"Failed to initialize any backend! Wayland status: {:?} X11 status: {:?}",
wayland_err, x11_err,
);
panic!(err_string);
}
#[cfg(feature = "wayland")]

View file

@ -135,7 +135,7 @@ impl<T: 'static> EventLoop<T> {
let ime = RefCell::new({
let result = Ime::new(Arc::clone(&xconn));
if let Err(ImeCreationError::OpenFailure(ref state)) = result {
panic!(format!("Failed to open input method: {:#?}", state));
panic!("Failed to open input method: {:#?}", state);
}
result.expect("Failed to set input method destruction callback")
});

View file

@ -27,12 +27,11 @@ impl XConnection {
(self.xlib.XInternAtom)(self.display, name.as_ptr() as *const c_char, ffi::False)
};
if atom == 0 {
let msg = format!(
panic!(
"`XInternAtom` failed, which really shouldn't happen. Atom: {:?}, Error: {:#?}",
name,
self.check_errors(),
);
panic!(msg);
}
/*println!(
"XInternAtom name:{:?} atom:{:?}",

View file

@ -17,6 +17,7 @@ use stdweb::web::event::{
use stdweb::web::html_element::CanvasElement;
use stdweb::web::{document, EventListenerHandle, IElement, IEventTarget, IHtmlElement};
#[allow(dead_code)]
pub struct Canvas {
/// Note: resizing the CanvasElement should go through `backend::set_canvas_size` to ensure the DPI factor is maintained.
raw: CanvasElement,

View file

@ -18,6 +18,7 @@ use web_sys::{
mod mouse_handler;
mod pointer_handler;
#[allow(dead_code)]
pub struct Canvas {
common: Common,
on_focus: Option<EventListenerHandle<dyn FnMut(FocusEvent)>>,

View file

@ -8,6 +8,7 @@ use std::rc::Rc;
use web_sys::{EventTarget, MouseEvent};
#[allow(dead_code)]
pub(super) struct MouseHandler {
on_mouse_leave: Option<EventListenerHandle<dyn FnMut(MouseEvent)>>,
on_mouse_enter: Option<EventListenerHandle<dyn FnMut(MouseEvent)>>,

View file

@ -5,6 +5,7 @@ use crate::event::{ModifiersState, MouseButton};
use web_sys::PointerEvent;
#[allow(dead_code)]
pub(super) struct PointerHandler {
on_cursor_leave: Option<EventListenerHandle<dyn FnMut(PointerEvent)>>,
on_cursor_enter: Option<EventListenerHandle<dyn FnMut(PointerEvent)>>,