Fix clippy lints

This commit is contained in:
Héctor Ramón Jiménez 2023-11-29 22:37:54 +01:00
parent 9b34b2ac19
commit 7def3ee38a
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
4 changed files with 28 additions and 19 deletions

View file

@ -228,7 +228,7 @@ where
match operation.finish() { match operation.finish() {
operation::Outcome::None => {} operation::Outcome::None => {}
operation::Outcome::Some(message) => { operation::Outcome::Some(message) => {
self.queued_messages.push(message) self.queued_messages.push(message);
} }
operation::Outcome::Chain(next) => { operation::Outcome::Chain(next) => {
current_operation = Some(next); current_operation = Some(next);

View file

@ -720,9 +720,10 @@ pub fn run_command<A, C, E>(
let _res = window.drag_window(); let _res = window.drag_window();
} }
window::Action::Spawn { .. } => { window::Action::Spawn { .. } => {
log::info!( log::warn!(
"Spawning a window is only available with multi-window applications." "Spawning a window is only available with \
) multi-window applications."
);
} }
window::Action::Resize(size) => { window::Action::Resize(size) => {
window.set_inner_size(winit::dpi::LogicalSize { window.set_inner_size(winit::dpi::LogicalSize {

View file

@ -912,7 +912,7 @@ pub fn run_command<A, C, E>(
size.width, size.width,
size.height, size.height,
)))) ))))
.expect("Send message to event loop") .expect("Send message to event loop");
} }
window::Action::Maximize(maximized) => { window::Action::Maximize(maximized) => {
windows.with_raw(id).set_maximized(maximized); windows.with_raw(id).set_maximized(maximized);
@ -934,7 +934,9 @@ pub fn run_command<A, C, E>(
)); ));
} }
window::Action::ChangeIcon(icon) => { window::Action::ChangeIcon(icon) => {
windows.with_raw(id).set_window_icon(conversion::icon(icon)) windows
.with_raw(id)
.set_window_icon(conversion::icon(icon));
} }
window::Action::FetchMode(tag) => { window::Action::FetchMode(tag) => {
let window = windows.with_raw(id); let window = windows.with_raw(id);
@ -969,12 +971,14 @@ pub fn run_command<A, C, E>(
.with_raw(id) .with_raw(id)
.set_window_level(conversion::window_level(level)); .set_window_level(conversion::window_level(level));
} }
window::Action::FetchId(tag) => proxy window::Action::FetchId(tag) => {
.send_event(Event::Application(tag(windows proxy
.with_raw(id) .send_event(Event::Application(tag(windows
.id() .with_raw(id)
.into()))) .id()
.expect("Event loop doesn't exist."), .into())))
.expect("Event loop doesn't exist.");
}
window::Action::Screenshot(tag) => { window::Action::Screenshot(tag) => {
let i = windows.index_from_id(id); let i = windows.index_from_id(id);
let state = &windows.states[i]; let state = &windows.states[i];
@ -996,7 +1000,7 @@ pub fn run_command<A, C, E>(
state.physical_size(), state.physical_size(),
), ),
))) )))
.expect("Event loop doesn't exist.") .expect("Event loop doesn't exist.");
} }
}, },
command::Action::System(action) => match action { command::Action::System(action) => match action {
@ -1014,7 +1018,7 @@ pub fn run_command<A, C, E>(
proxy proxy
.send_event(Event::Application(message)) .send_event(Event::Application(message))
.expect("Event loop doesn't exist.") .expect("Event loop doesn't exist.");
}); });
} }
} }

View file

@ -1,10 +1,12 @@
use crate::core::{window, Size}; use crate::core::{window, Size};
use crate::graphics::Compositor;
use crate::multi_window::{Application, State}; use crate::multi_window::{Application, State};
use iced_graphics::Compositor; use crate::style::application::StyleSheet;
use iced_style::application::StyleSheet;
use std::fmt::{Debug, Formatter};
use winit::monitor::MonitorHandle; use winit::monitor::MonitorHandle;
use std::fmt::{Debug, Formatter};
pub struct Windows<A: Application, C: Compositor> pub struct Windows<A: Application, C: Compositor>
where where
<A::Renderer as crate::core::Renderer>::Theme: StyleSheet, <A::Renderer as crate::core::Renderer>::Theme: StyleSheet,
@ -33,7 +35,7 @@ where
&self &self
.raw .raw
.iter() .iter()
.map(|raw| raw.id()) .map(winit::window::Window::id)
.collect::<Vec<winit::window::WindowId>>(), .collect::<Vec<winit::window::WindowId>>(),
) )
.field("states", &self.states) .field("states", &self.states)
@ -131,7 +133,9 @@ where
} }
pub fn last_monitor(&self) -> Option<MonitorHandle> { pub fn last_monitor(&self) -> Option<MonitorHandle> {
self.raw.last().and_then(|w| w.current_monitor()) self.raw
.last()
.and_then(winit::window::Window::current_monitor)
} }
pub fn last(&self) -> usize { pub fn last(&self) -> usize {