Fix clippy issues on stable
This commit is contained in:
parent
e1b7fda409
commit
930df0ec45
36 changed files with 68 additions and 76 deletions
|
|
@ -349,10 +349,10 @@ impl<T: 'static> EventLoop<T> {
|
|||
}
|
||||
}
|
||||
|
||||
fn single_iteration<'a, F>(
|
||||
fn single_iteration<F>(
|
||||
&mut self,
|
||||
control_flow: &mut ControlFlow,
|
||||
main_event: Option<MainEvent<'a>>,
|
||||
main_event: Option<MainEvent<'_>>,
|
||||
pending_redraw: &mut bool,
|
||||
cause: &mut StartCause,
|
||||
callback: &mut F,
|
||||
|
|
|
|||
|
|
@ -727,8 +727,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
panic!("wayland feature is not enabled");
|
||||
}
|
||||
_ => panic!(
|
||||
"Unknown environment variable value for {}, try one of `x11`,`wayland`",
|
||||
BACKEND_PREFERENCE_ENV_VAR,
|
||||
"Unknown environment variable value for {BACKEND_PREFERENCE_ENV_VAR}, try one of `x11`,`wayland`",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
@ -751,8 +750,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
let x11_err = "backend disabled";
|
||||
|
||||
panic!(
|
||||
"Failed to initialize any backend! Wayland status: {:?} X11 status: {:?}",
|
||||
wayland_err, x11_err,
|
||||
"Failed to initialize any backend! Wayland status: {wayland_err:?} X11 status: {x11_err:?}",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ pub unsafe extern "C" fn xim_instantiate_callback(
|
|||
Err(err) => {
|
||||
if (*inner).is_destroyed {
|
||||
// We have no usable input methods!
|
||||
panic!("Failed to reopen input method: {:?}", err);
|
||||
panic!("Failed to reopen input method: {err:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ pub unsafe extern "C" fn xim_destroy_callback(
|
|||
Ok(()) => (*inner).is_fallback = true,
|
||||
Err(err) => {
|
||||
// We have no usable input methods!
|
||||
panic!("Failed to open fallback input method: {:?}", err);
|
||||
panic!("Failed to open fallback input method: {err:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ impl Ime {
|
|||
if self.is_destroyed() {
|
||||
return None;
|
||||
}
|
||||
if let Some(&Some(ref context)) = self.inner.contexts.get(&window) {
|
||||
if let Some(Some(context)) = self.inner.contexts.get(&window) {
|
||||
Some(context.ic)
|
||||
} else {
|
||||
None
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
let ime = RefCell::new({
|
||||
let result = Ime::new(Arc::clone(&xconn), ime_event_sender);
|
||||
if let Err(ImeCreationError::OpenFailure(ref state)) = result {
|
||||
panic!("Failed to open input method: {:#?}", state);
|
||||
panic!("Failed to open input method: {state:#?}");
|
||||
}
|
||||
result.expect("Failed to set input method destruction callback")
|
||||
});
|
||||
|
|
@ -212,8 +212,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
) != ffi::Success as libc::c_int
|
||||
{
|
||||
panic!(
|
||||
"X server has XInput extension {}.{} but does not support XInput2",
|
||||
xinput_major_ver, xinput_minor_ver,
|
||||
"X server has XInput extension {xinput_major_ver}.{xinput_minor_ver} but does not support XInput2",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -454,7 +453,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
// Wait until
|
||||
if let Err(e) = self.poll.poll(&mut events, iter_result.timeout) {
|
||||
if e.raw_os_error() != Some(libc::EINTR) {
|
||||
panic!("epoll returned an error: {:?}", e);
|
||||
panic!("epoll returned an error: {e:?}");
|
||||
}
|
||||
}
|
||||
events.clear();
|
||||
|
|
|
|||
|
|
@ -117,8 +117,7 @@ impl XConnection {
|
|||
EnvVarDPI::NotSet
|
||||
} else {
|
||||
panic!(
|
||||
"`WINIT_X11_SCALE_FACTOR` invalid; DPI factors must be either normal floats greater than 0, or `randr`. Got `{}`",
|
||||
var
|
||||
"`WINIT_X11_SCALE_FACTOR` invalid; DPI factors must be either normal floats greater than 0, or `randr`. Got `{var}`"
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
@ -132,8 +131,7 @@ impl XConnection {
|
|||
EnvVarDPI::Scale(dpi_override) => {
|
||||
if !validate_scale_factor(dpi_override) {
|
||||
panic!(
|
||||
"`WINIT_X11_SCALE_FACTOR` invalid; DPI factors must be either normal floats greater than 0, or `randr`. Got `{}`",
|
||||
dpi_override,
|
||||
"`WINIT_X11_SCALE_FACTOR` invalid; DPI factors must be either normal floats greater than 0, or `randr`. Got `{dpi_override}`",
|
||||
);
|
||||
}
|
||||
dpi_override
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ impl AppState {
|
|||
|
||||
pub fn queue_event(wrapper: EventWrapper) {
|
||||
if !is_main_thread() {
|
||||
panic!("Event queued from different thread: {:#?}", wrapper);
|
||||
panic!("Event queued from different thread: {wrapper:#?}");
|
||||
}
|
||||
HANDLER.events().push_back(wrapper);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ impl Window {
|
|||
impl fmt::Display for OsError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
OsError::CGError(e) => f.pad(&format!("CGError {}", e)),
|
||||
OsError::CGError(e) => f.pad(&format!("CGError {e}")),
|
||||
OsError::CreationError(e) => f.pad(e),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ impl MonitorHandle {
|
|||
pub fn name(&self) -> Option<String> {
|
||||
let MonitorHandle(display_id) = *self;
|
||||
let screen_num = CGDisplay::new(display_id).model_number();
|
||||
Some(format!("Monitor #{}", screen_num))
|
||||
Some(format!("Monitor #{screen_num}"))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
|
|
@ -522,7 +522,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
// Acknowledge the latest resize event.
|
||||
if let Some((w, h)) = event_state.resize_opt.take() {
|
||||
window
|
||||
.write(format!("S,{},{}", w, h).as_bytes())
|
||||
.write(format!("S,{w},{h}").as_bytes())
|
||||
.expect("failed to acknowledge resize");
|
||||
|
||||
// Require redraw after resize.
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ impl RedoxSocket {
|
|||
}
|
||||
|
||||
fn orbital(properties: &WindowProperties<'_>) -> syscall::Result<Self> {
|
||||
Self::open_raw(&format!("{}", properties))
|
||||
Self::open_raw(&format!("{properties}"))
|
||||
}
|
||||
|
||||
// Paths should be checked to ensure they are actually sockets and not normal files. If a
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ impl Window {
|
|||
//TODO: adjust for window decorations
|
||||
let (x, y): (i32, i32) = position.to_physical::<i32>(self.scale_factor()).into();
|
||||
self.window_socket
|
||||
.write(format!("P,{},{}", x, y).as_bytes())
|
||||
.write(format!("P,{x},{y}").as_bytes())
|
||||
.expect("failed to set position");
|
||||
}
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ impl Window {
|
|||
pub fn set_inner_size(&self, size: Size) {
|
||||
let (w, h): (u32, u32) = size.to_physical::<u32>(self.scale_factor()).into();
|
||||
self.window_socket
|
||||
.write(format!("S,{},{}", w, h).as_bytes())
|
||||
.write(format!("S,{w},{h}").as_bytes())
|
||||
.expect("failed to set size");
|
||||
}
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ impl Window {
|
|||
#[inline]
|
||||
pub fn set_title(&self, title: &str) {
|
||||
self.window_socket
|
||||
.write(format!("T,{}", title).as_bytes())
|
||||
.write(format!("T,{title}").as_bytes())
|
||||
.expect("failed to set title");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ impl Canvas {
|
|||
self.common
|
||||
.raw
|
||||
.set_attribute(attribute, value)
|
||||
.unwrap_or_else(|err| panic!("error: {:?}\nSet attribute: {}", err, attribute))
|
||||
.unwrap_or_else(|err| panic!("error: {err:?}\nSet attribute: {attribute}"))
|
||||
}
|
||||
|
||||
pub fn position(&self) -> LogicalPosition<f64> {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ pub fn set_canvas_style_property(raw: &HtmlCanvasElement, property: &str, value:
|
|||
let style = raw.style();
|
||||
style
|
||||
.set_property(property, value)
|
||||
.unwrap_or_else(|err| panic!("error: {:?}\nFailed to set {}", err, property))
|
||||
.unwrap_or_else(|err| panic!("error: {err:?}\nFailed to set {property}"))
|
||||
}
|
||||
|
||||
pub fn is_fullscreen(canvas: &HtmlCanvasElement) -> bool {
|
||||
|
|
|
|||
|
|
@ -387,8 +387,7 @@ fn get_wait_thread_id() -> u32 {
|
|||
);
|
||||
assert_eq!(
|
||||
msg.message, *SEND_WAIT_THREAD_ID_MSG_ID,
|
||||
"this shouldn't be possible. please open an issue with Winit. error code: {}",
|
||||
result
|
||||
"this shouldn't be possible. please open an issue with Winit. error code: {result}"
|
||||
);
|
||||
msg.lParam as u32
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue