Fix clippy issues on stable

This commit is contained in:
Kirill Chibisov 2023-01-27 07:18:58 +03:00 committed by GitHub
parent e1b7fda409
commit 930df0ec45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 68 additions and 76 deletions

View file

@ -27,7 +27,7 @@ fn main() {
let id = child_window.id(); let id = child_window.id();
windows.insert(id, child_window); windows.insert(id, child_window);
println!("child window created with id: {:?}", id); println!("child window created with id: {id:?}");
} }
let mut windows = HashMap::new(); let mut windows = HashMap::new();
@ -40,7 +40,7 @@ fn main() {
.build(&event_loop) .build(&event_loop)
.unwrap(); .unwrap();
println!("parent window: {:?})", parent_window); println!("parent window: {parent_window:?})");
event_loop.run(move |event: Event<'_, ()>, event_loop, control_flow| { event_loop.run(move |event: Event<'_, ()>, event_loop, control_flow| {
*control_flow = ControlFlow::Wait; *control_flow = ControlFlow::Wait;
@ -56,7 +56,7 @@ fn main() {
// by some key inputs. // by some key inputs.
// the child windows are always placed at (0, 0) with size (200, 200) in the parent window, // the child windows are always placed at (0, 0) with size (200, 200) in the parent window,
// so we also can see this log when we move the cursor arround (200, 200) in parent window. // so we also can see this log when we move the cursor arround (200, 200) in parent window.
println!("cursor entered in the window {:?}", window_id); println!("cursor entered in the window {window_id:?}");
} }
WindowEvent::KeyboardInput { WindowEvent::KeyboardInput {
input: input:

View file

@ -41,7 +41,7 @@ fn main() {
event_loop.run(move |event, _, control_flow| { event_loop.run(move |event, _, control_flow| {
use winit::event::{ElementState, StartCause, VirtualKeyCode}; use winit::event::{ElementState, StartCause, VirtualKeyCode};
println!("{:?}", event); println!("{event:?}");
match event { match event {
Event::NewEvents(start_cause) => { Event::NewEvents(start_cause) => {
wait_cancelled = match start_cause { wait_cancelled = match start_cause {
@ -64,19 +64,19 @@ fn main() {
} => match virtual_code { } => match virtual_code {
VirtualKeyCode::Key1 => { VirtualKeyCode::Key1 => {
mode = Mode::Wait; mode = Mode::Wait;
println!("\nmode: {:?}\n", mode); println!("\nmode: {mode:?}\n");
} }
VirtualKeyCode::Key2 => { VirtualKeyCode::Key2 => {
mode = Mode::WaitUntil; mode = Mode::WaitUntil;
println!("\nmode: {:?}\n", mode); println!("\nmode: {mode:?}\n");
} }
VirtualKeyCode::Key3 => { VirtualKeyCode::Key3 => {
mode = Mode::Poll; mode = Mode::Poll;
println!("\nmode: {:?}\n", mode); println!("\nmode: {mode:?}\n");
} }
VirtualKeyCode::R => { VirtualKeyCode::R => {
request_redraw = !request_redraw; request_redraw = !request_redraw;
println!("\nrequest_redraw: {}\n", request_redraw); println!("\nrequest_redraw: {request_redraw}\n");
} }
VirtualKeyCode::Escape => { VirtualKeyCode::Escape => {
close_requested = true; close_requested = true;

View file

@ -50,17 +50,17 @@ fn main() {
}; };
if let Err(err) = result { if let Err(err) = result {
println!("error: {}", err); println!("error: {err}");
} }
} }
WindowEvent::ModifiersChanged(m) => modifiers = m, WindowEvent::ModifiersChanged(m) => modifiers = m,
_ => (), _ => (),
}, },
Event::DeviceEvent { event, .. } => match event { Event::DeviceEvent { event, .. } => match event {
DeviceEvent::MouseMotion { delta } => println!("mouse moved: {:?}", delta), DeviceEvent::MouseMotion { delta } => println!("mouse moved: {delta:?}"),
DeviceEvent::Button { button, state } => match state { DeviceEvent::Button { button, state } => match state {
ElementState::Pressed => println!("mouse button {} pressed", button), ElementState::Pressed => println!("mouse button {button} pressed"),
ElementState::Released => println!("mouse button {} released", button), ElementState::Released => println!("mouse button {button} released"),
}, },
_ => (), _ => (),
}, },

View file

@ -39,7 +39,7 @@ fn main() {
control_flow.set_wait(); control_flow.set_wait();
match event { match event {
Event::UserEvent(event) => println!("user event: {:?}", event), Event::UserEvent(event) => println!("user event: {event:?}"),
Event::WindowEvent { Event::WindowEvent {
event: WindowEvent::CloseRequested, event: WindowEvent::CloseRequested,
.. ..

View file

@ -26,7 +26,7 @@ fn main() {
let mut mode_index = 0; let mut mode_index = 0;
let mut mode = monitor.video_modes().next().expect("no mode found"); let mut mode = monitor.video_modes().next().expect("no mode found");
println!("Mode: {}", mode); println!("Mode: {mode}");
println!("Keys:"); println!("Keys:");
println!("- Esc\tExit"); println!("- Esc\tExit");
@ -59,12 +59,12 @@ fn main() {
} }
VirtualKeyCode::F => { VirtualKeyCode::F => {
let fullscreen = Some(Fullscreen::Exclusive(mode.clone())); let fullscreen = Some(Fullscreen::Exclusive(mode.clone()));
println!("Setting mode: {:?}", fullscreen); println!("Setting mode: {fullscreen:?}");
window.set_fullscreen(fullscreen); window.set_fullscreen(fullscreen);
} }
VirtualKeyCode::B => { VirtualKeyCode::B => {
let fullscreen = Some(Fullscreen::Borderless(Some(monitor.clone()))); let fullscreen = Some(Fullscreen::Borderless(Some(monitor.clone())));
println!("Setting mode: {:?}", fullscreen); println!("Setting mode: {fullscreen:?}");
window.set_fullscreen(fullscreen); window.set_fullscreen(fullscreen);
} }
VirtualKeyCode::S => { VirtualKeyCode::S => {
@ -79,7 +79,7 @@ fn main() {
mode_index = 0; mode_index = 0;
mode = monitor.video_modes().next().expect("no mode found"); mode = monitor.video_modes().next().expect("no mode found");
println!("Mode: {}", mode); println!("Mode: {mode}");
} }
VirtualKeyCode::M => { VirtualKeyCode::M => {
mode_index += 1; mode_index += 1;
@ -89,7 +89,7 @@ fn main() {
mode_index = 0; mode_index = 0;
mode = monitor.video_modes().next().expect("no mode found"); mode = monitor.video_modes().next().expect("no mode found");
} }
println!("Mode: {}", mode); println!("Mode: {mode}");
} }
VirtualKeyCode::D => { VirtualKeyCode::D => {
decorations = !decorations; decorations = !decorations;

View file

@ -67,7 +67,7 @@ fn main() {
event: WindowEvent::Ime(event), event: WindowEvent::Ime(event),
.. ..
} => { } => {
println!("{:?}", event); println!("{event:?}");
may_show_ime = event != Ime::Disabled; may_show_ime = event != Ime::Disabled;
if may_show_ime { if may_show_ime {
window.set_ime_position(ime_pos); window.set_ime_position(ime_pos);
@ -77,20 +77,20 @@ fn main() {
event: WindowEvent::ReceivedCharacter(ch), event: WindowEvent::ReceivedCharacter(ch),
.. ..
} => { } => {
println!("ch: {:?}", ch); println!("ch: {ch:?}");
} }
Event::WindowEvent { Event::WindowEvent {
event: WindowEvent::KeyboardInput { input, .. }, event: WindowEvent::KeyboardInput { input, .. },
.. ..
} => { } => {
println!("key: {:?}", input); println!("key: {input:?}");
if input.state == ElementState::Pressed if input.state == ElementState::Pressed
&& input.virtual_keycode == Some(VirtualKeyCode::F2) && input.virtual_keycode == Some(VirtualKeyCode::F2)
{ {
ime_allowed = !ime_allowed; ime_allowed = !ime_allowed;
window.set_ime_allowed(ime_allowed); window.set_ime_allowed(ime_allowed);
println!("\nIME: {}\n", ime_allowed); println!("\nIME: {ime_allowed}\n");
} }
} }
_ => (), _ => (),

View file

@ -39,7 +39,7 @@ In other words, the deltas indicate the direction in which to move the content (
WindowEvent::CloseRequested => control_flow.set_exit(), WindowEvent::CloseRequested => control_flow.set_exit(),
WindowEvent::MouseWheel { delta, .. } => match delta { WindowEvent::MouseWheel { delta, .. } => match delta {
winit::event::MouseScrollDelta::LineDelta(x, y) => { winit::event::MouseScrollDelta::LineDelta(x, y) => {
println!("mouse wheel Line Delta: ({},{})", x, y); println!("mouse wheel Line Delta: ({x},{y})");
let pixels_per_line = 120.0; let pixels_per_line = 120.0;
let mut pos = window.outer_position().unwrap(); let mut pos = window.outer_position().unwrap();
pos.x += (x * pixels_per_line) as i32; pos.x += (x * pixels_per_line) as i32;

View file

@ -62,7 +62,7 @@ fn main() {
}, },
.. ..
} => { } => {
window.set_title(&format!("{:?}", key)); window.set_title(&format!("{key:?}"));
let state = !modifiers.shift(); let state = !modifiers.shift();
use VirtualKeyCode::*; use VirtualKeyCode::*;
match key { match key {
@ -92,17 +92,17 @@ fn main() {
}), }),
L if state => { L if state => {
if let Err(err) = window.set_cursor_grab(CursorGrabMode::Locked) { if let Err(err) = window.set_cursor_grab(CursorGrabMode::Locked) {
println!("error: {}", err); println!("error: {err}");
} }
} }
G if state => { G if state => {
if let Err(err) = window.set_cursor_grab(CursorGrabMode::Confined) { if let Err(err) = window.set_cursor_grab(CursorGrabMode::Confined) {
println!("error: {}", err); println!("error: {err}");
} }
} }
G | L if !state => { G | L if !state => {
if let Err(err) = window.set_cursor_grab(CursorGrabMode::None) { if let Err(err) = window.set_cursor_grab(CursorGrabMode::None) {
println!("error: {}", err); println!("error: {err}");
} }
} }
H => window.set_cursor_visible(!state), H => window.set_cursor_visible(!state),

View file

@ -29,7 +29,7 @@ fn main() {
Event::WindowEvent { event, window_id } => { Event::WindowEvent { event, window_id } => {
match event { match event {
WindowEvent::CloseRequested => { WindowEvent::CloseRequested => {
println!("Window {:?} has received the signal to close", window_id); println!("Window {window_id:?} has received the signal to close");
// This drops the window, causing it to close. // This drops the window, causing it to close.
windows.remove(&window_id); windows.remove(&window_id);

View file

@ -17,7 +17,7 @@ fn main() {
.unwrap(); .unwrap();
event_loop.run(move |event, _, control_flow| { event_loop.run(move |event, _, control_flow| {
println!("{:?}", event); println!("{event:?}");
control_flow.set_wait(); control_flow.set_wait();

View file

@ -25,7 +25,7 @@ fn main() {
}); });
event_loop.run(move |event, _, control_flow| { event_loop.run(move |event, _, control_flow| {
println!("{:?}", event); println!("{event:?}");
control_flow.set_wait(); control_flow.set_wait();

View file

@ -39,7 +39,7 @@ fn main() {
.. ..
} => { } => {
resizable = !resizable; resizable = !resizable;
println!("Resizable: {}", resizable); println!("Resizable: {resizable}");
window.set_resizable(resizable); window.set_resizable(resizable);
} }
_ => (), _ => (),

View file

@ -36,7 +36,7 @@ fn main() {
window_id, window_id,
.. ..
} if window_id == window.id() => { } if window_id == window.id() => {
println!("Theme is changed: {:?}", theme) println!("Theme is changed: {theme:?}")
} }
Event::WindowEvent { Event::WindowEvent {
event: event:

View file

@ -22,7 +22,7 @@ fn main() {
let timer_length = Duration::new(1, 0); let timer_length = Duration::new(1, 0);
event_loop.run(move |event, _, control_flow| { event_loop.run(move |event, _, control_flow| {
println!("{:?}", event); println!("{event:?}");
match event { match event {
Event::NewEvents(StartCause::Init) => { Event::NewEvents(StartCause::Init) => {

View file

@ -24,9 +24,9 @@ fn main() {
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit, WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
WindowEvent::TouchpadMagnify { delta, .. } => { WindowEvent::TouchpadMagnify { delta, .. } => {
if delta > 0.0 { if delta > 0.0 {
println!("Zoomed in {}", delta); println!("Zoomed in {delta}");
} else { } else {
println!("Zoomed out {}", delta); println!("Zoomed out {delta}");
} }
} }
WindowEvent::SmartMagnify { .. } => { WindowEvent::SmartMagnify { .. } => {
@ -34,9 +34,9 @@ fn main() {
} }
WindowEvent::TouchpadRotate { delta, .. } => { WindowEvent::TouchpadRotate { delta, .. } => {
if delta > 0.0 { if delta > 0.0 {
println!("Rotated counterclockwise {}", delta); println!("Rotated counterclockwise {delta}");
} else { } else {
println!("Rotated clockwise {}", delta); println!("Rotated clockwise {delta}");
} }
} }
_ => (), _ => (),

View file

@ -21,7 +21,7 @@ fn main() {
event_loop.run(move |event, _, control_flow| { event_loop.run(move |event, _, control_flow| {
control_flow.set_wait(); control_flow.set_wait();
println!("{:?}", event); println!("{event:?}");
match event { match event {
Event::WindowEvent { Event::WindowEvent {

View file

@ -17,6 +17,6 @@ fn main() {
println!("Listing available video modes:"); println!("Listing available video modes:");
for mode in monitor.video_modes() { for mode in monitor.video_modes() {
println!("{}", mode); println!("{mode}");
} }
} }

View file

@ -81,7 +81,7 @@ mod wasm {
let window = web_sys::window().unwrap(); let window = web_sys::window().unwrap();
let document = window.document().unwrap(); let document = window.document().unwrap();
let log = document.create_element("li").unwrap(); let log = document.create_element("li").unwrap();
log.set_text_content(Some(&format!("{:?}", event))); log.set_text_content(Some(&format!("{event:?}")));
log_list log_list
.insert_before(&log, log_list.first_child().as_ref()) .insert_before(&log, log_list.first_child().as_ref())
.unwrap(); .unwrap();

View file

@ -19,7 +19,7 @@ fn main() {
event_loop.run(move |event, _, control_flow| { event_loop.run(move |event, _, control_flow| {
control_flow.set_wait(); control_flow.set_wait();
println!("{:?}", event); println!("{event:?}");
match event { match event {
Event::WindowEvent { Event::WindowEvent {

View file

@ -35,7 +35,7 @@ fn main() {
if let Event::WindowEvent { event, .. } = &event { if let Event::WindowEvent { event, .. } = &event {
// Print only Window events to reduce noise // Print only Window events to reduce noise
println!("{:?}", event); println!("{event:?}");
} }
match event { match event {

View file

@ -34,8 +34,7 @@ impl fmt::Display for BadIcon {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self { match self {
BadIcon::ByteCountNotDivisibleBy4 { byte_count } => write!(f, BadIcon::ByteCountNotDivisibleBy4 { byte_count } => write!(f,
"The length of the `rgba` argument ({:?}) isn't divisible by 4, making it impossible to interpret as 32bpp RGBA pixels.", "The length of the `rgba` argument ({byte_count:?}) isn't divisible by 4, making it impossible to interpret as 32bpp RGBA pixels.",
byte_count,
), ),
BadIcon::DimensionsVsPixelCount { BadIcon::DimensionsVsPixelCount {
width, width,
@ -43,10 +42,9 @@ impl fmt::Display for BadIcon {
width_x_height, width_x_height,
pixel_count, pixel_count,
} => write!(f, } => write!(f,
"The specified dimensions ({:?}x{:?}) don't match the number of pixels supplied by the `rgba` argument ({:?}). For those dimensions, the expected pixel count is {:?}.", "The specified dimensions ({width:?}x{height:?}) don't match the number of pixels supplied by the `rgba` argument ({pixel_count:?}). For those dimensions, the expected pixel count is {width_x_height:?}.",
width, height, pixel_count, width_x_height,
), ),
BadIcon::OsError(e) => write!(f, "OS error when instantiating the icon: {:?}", e), BadIcon::OsError(e) => write!(f, "OS error when instantiating the icon: {e:?}"),
} }
} }
} }

View file

@ -349,10 +349,10 @@ impl<T: 'static> EventLoop<T> {
} }
} }
fn single_iteration<'a, F>( fn single_iteration<F>(
&mut self, &mut self,
control_flow: &mut ControlFlow, control_flow: &mut ControlFlow,
main_event: Option<MainEvent<'a>>, main_event: Option<MainEvent<'_>>,
pending_redraw: &mut bool, pending_redraw: &mut bool,
cause: &mut StartCause, cause: &mut StartCause,
callback: &mut F, callback: &mut F,

View file

@ -727,8 +727,7 @@ impl<T: 'static> EventLoop<T> {
panic!("wayland feature is not enabled"); panic!("wayland feature is not enabled");
} }
_ => panic!( _ => panic!(
"Unknown environment variable value for {}, try one of `x11`,`wayland`", "Unknown environment variable value for {BACKEND_PREFERENCE_ENV_VAR}, try one of `x11`,`wayland`",
BACKEND_PREFERENCE_ENV_VAR,
), ),
} }
} }
@ -751,8 +750,7 @@ impl<T: 'static> EventLoop<T> {
let x11_err = "backend disabled"; let x11_err = "backend disabled";
panic!( panic!(
"Failed to initialize any backend! Wayland status: {:?} X11 status: {:?}", "Failed to initialize any backend! Wayland status: {wayland_err:?} X11 status: {x11_err:?}",
wayland_err, x11_err,
); );
} }

View file

@ -168,7 +168,7 @@ pub unsafe extern "C" fn xim_instantiate_callback(
Err(err) => { Err(err) => {
if (*inner).is_destroyed { if (*inner).is_destroyed {
// We have no usable input methods! // 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, Ok(()) => (*inner).is_fallback = true,
Err(err) => { Err(err) => {
// We have no usable input methods! // We have no usable input methods!
panic!("Failed to open fallback input method: {:?}", err); panic!("Failed to open fallback input method: {err:?}");
} }
} }
} }

View file

@ -171,7 +171,7 @@ impl Ime {
if self.is_destroyed() { if self.is_destroyed() {
return None; 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) Some(context.ic)
} else { } else {
None None

View file

@ -175,7 +175,7 @@ impl<T: 'static> EventLoop<T> {
let ime = RefCell::new({ let ime = RefCell::new({
let result = Ime::new(Arc::clone(&xconn), ime_event_sender); let result = Ime::new(Arc::clone(&xconn), ime_event_sender);
if let Err(ImeCreationError::OpenFailure(ref state)) = result { 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") result.expect("Failed to set input method destruction callback")
}); });
@ -212,8 +212,7 @@ impl<T: 'static> EventLoop<T> {
) != ffi::Success as libc::c_int ) != ffi::Success as libc::c_int
{ {
panic!( panic!(
"X server has XInput extension {}.{} but does not support XInput2", "X server has XInput extension {xinput_major_ver}.{xinput_minor_ver} but does not support XInput2",
xinput_major_ver, xinput_minor_ver,
); );
} }
} }
@ -454,7 +453,7 @@ impl<T: 'static> EventLoop<T> {
// Wait until // Wait until
if let Err(e) = self.poll.poll(&mut events, iter_result.timeout) { if let Err(e) = self.poll.poll(&mut events, iter_result.timeout) {
if e.raw_os_error() != Some(libc::EINTR) { if e.raw_os_error() != Some(libc::EINTR) {
panic!("epoll returned an error: {:?}", e); panic!("epoll returned an error: {e:?}");
} }
} }
events.clear(); events.clear();

View file

@ -117,8 +117,7 @@ impl XConnection {
EnvVarDPI::NotSet EnvVarDPI::NotSet
} else { } else {
panic!( panic!(
"`WINIT_X11_SCALE_FACTOR` invalid; DPI factors must be either normal floats greater than 0, or `randr`. Got `{}`", "`WINIT_X11_SCALE_FACTOR` invalid; DPI factors must be either normal floats greater than 0, or `randr`. Got `{var}`"
var
); );
} }
}, },
@ -132,8 +131,7 @@ impl XConnection {
EnvVarDPI::Scale(dpi_override) => { EnvVarDPI::Scale(dpi_override) => {
if !validate_scale_factor(dpi_override) { if !validate_scale_factor(dpi_override) {
panic!( panic!(
"`WINIT_X11_SCALE_FACTOR` invalid; DPI factors must be either normal floats greater than 0, or `randr`. Got `{}`", "`WINIT_X11_SCALE_FACTOR` invalid; DPI factors must be either normal floats greater than 0, or `randr`. Got `{dpi_override}`",
dpi_override,
); );
} }
dpi_override dpi_override

View file

@ -363,7 +363,7 @@ impl AppState {
pub fn queue_event(wrapper: EventWrapper) { pub fn queue_event(wrapper: EventWrapper) {
if !is_main_thread() { if !is_main_thread() {
panic!("Event queued from different thread: {:#?}", wrapper); panic!("Event queued from different thread: {wrapper:#?}");
} }
HANDLER.events().push_back(wrapper); HANDLER.events().push_back(wrapper);
} }

View file

@ -92,7 +92,7 @@ impl Window {
impl fmt::Display for OsError { impl fmt::Display for OsError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self { match self {
OsError::CGError(e) => f.pad(&format!("CGError {}", e)), OsError::CGError(e) => f.pad(&format!("CGError {e}")),
OsError::CreationError(e) => f.pad(e), OsError::CreationError(e) => f.pad(e),
} }
} }

View file

@ -182,7 +182,7 @@ impl MonitorHandle {
pub fn name(&self) -> Option<String> { pub fn name(&self) -> Option<String> {
let MonitorHandle(display_id) = *self; let MonitorHandle(display_id) = *self;
let screen_num = CGDisplay::new(display_id).model_number(); let screen_num = CGDisplay::new(display_id).model_number();
Some(format!("Monitor #{}", screen_num)) Some(format!("Monitor #{screen_num}"))
} }
#[inline] #[inline]

View file

@ -522,7 +522,7 @@ impl<T: 'static> EventLoop<T> {
// Acknowledge the latest resize event. // Acknowledge the latest resize event.
if let Some((w, h)) = event_state.resize_opt.take() { if let Some((w, h)) = event_state.resize_opt.take() {
window window
.write(format!("S,{},{}", w, h).as_bytes()) .write(format!("S,{w},{h}").as_bytes())
.expect("failed to acknowledge resize"); .expect("failed to acknowledge resize");
// Require redraw after resize. // Require redraw after resize.

View file

@ -20,7 +20,7 @@ impl RedoxSocket {
} }
fn orbital(properties: &WindowProperties<'_>) -> syscall::Result<Self> { 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 // Paths should be checked to ensure they are actually sockets and not normal files. If a

View file

@ -187,7 +187,7 @@ impl Window {
//TODO: adjust for window decorations //TODO: adjust for window decorations
let (x, y): (i32, i32) = position.to_physical::<i32>(self.scale_factor()).into(); let (x, y): (i32, i32) = position.to_physical::<i32>(self.scale_factor()).into();
self.window_socket self.window_socket
.write(format!("P,{},{}", x, y).as_bytes()) .write(format!("P,{x},{y}").as_bytes())
.expect("failed to set position"); .expect("failed to set position");
} }
@ -206,7 +206,7 @@ impl Window {
pub fn set_inner_size(&self, size: Size) { pub fn set_inner_size(&self, size: Size) {
let (w, h): (u32, u32) = size.to_physical::<u32>(self.scale_factor()).into(); let (w, h): (u32, u32) = size.to_physical::<u32>(self.scale_factor()).into();
self.window_socket self.window_socket
.write(format!("S,{},{}", w, h).as_bytes()) .write(format!("S,{w},{h}").as_bytes())
.expect("failed to set size"); .expect("failed to set size");
} }
@ -236,7 +236,7 @@ impl Window {
#[inline] #[inline]
pub fn set_title(&self, title: &str) { pub fn set_title(&self, title: &str) {
self.window_socket self.window_socket
.write(format!("T,{}", title).as_bytes()) .write(format!("T,{title}").as_bytes())
.expect("failed to set title"); .expect("failed to set title");
} }

View file

@ -115,7 +115,7 @@ impl Canvas {
self.common self.common
.raw .raw
.set_attribute(attribute, value) .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> { pub fn position(&self) -> LogicalPosition<f64> {

View file

@ -98,7 +98,7 @@ pub fn set_canvas_style_property(raw: &HtmlCanvasElement, property: &str, value:
let style = raw.style(); let style = raw.style();
style style
.set_property(property, value) .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 { pub fn is_fullscreen(canvas: &HtmlCanvasElement) -> bool {

View file

@ -387,8 +387,7 @@ fn get_wait_thread_id() -> u32 {
); );
assert_eq!( assert_eq!(
msg.message, *SEND_WAIT_THREAD_ID_MSG_ID, msg.message, *SEND_WAIT_THREAD_ID_MSG_ID,
"this shouldn't be possible. please open an issue with Winit. error code: {}", "this shouldn't be possible. please open an issue with Winit. error code: {result}"
result
); );
msg.lParam as u32 msg.lParam as u32
} }