Skip to content

Commit

Permalink
cleanup: formatting and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Dec 7, 2023
1 parent 4521d6e commit 56b6d65
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 36 deletions.
2 changes: 1 addition & 1 deletion examples/integration/src/controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Program for Controls {
Command::none()
}

fn view(&self, _: Id) -> Element<Message, Renderer<Theme>> {
fn view(&self) -> Element<Message, Renderer<Theme>> {
let background_color = self.background_color;
let text = &self.text;

Expand Down
4 changes: 2 additions & 2 deletions examples/integration/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
);

let mut state = program::State::new(
Id(0),
Id::MAIN,
controls,
viewport.logical_size(),
&mut renderer,
Expand Down Expand Up @@ -199,7 +199,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
if !state.is_queue_empty() {
// We update iced
let _ = state.update(
Id(0),
Id::MAIN,
viewport.logical_size(),
cursor_position
.map(|p| {
Expand Down
4 changes: 0 additions & 4 deletions examples/sctk_todos/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
use env_logger::Env;
use iced::alignment::{self, Alignment};
use iced::event::{self, listen_raw, Event};
use iced::subscription;
use iced::theme::{self, Theme};
use iced::wayland::actions::data_device::ActionInner;
use iced::wayland::actions::window::SctkWindowSettings;
use iced::wayland::data_device::action as data_device_action;
use iced::wayland::InitialSurface;
use iced::widget::{
self, button, checkbox, column, container, row, scrollable, text,
Expand All @@ -20,7 +17,6 @@ use iced_core::{id, keyboard};
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
use std::sync::Arc;

static INPUT_ID: Lazy<Id> = Lazy::new(Id::unique);

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/program/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ where
}

fn build_user_interface<'a, P: Program>(
id: crate::window::Id,
_id: crate::window::Id,
program: &'a mut P,
cache: user_interface::Cache,
renderer: &mut P::Renderer,
Expand Down
1 change: 0 additions & 1 deletion src/application.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! Build interactive cross-platform applications.
use iced_core::window::Id;
use crate::{Command, Element, Executor, Settings, Subscription};

Expand Down
4 changes: 2 additions & 2 deletions src/wayland/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub trait Application: Sized {
/// Returns the current [`Theme`] of the [`Application`].
///
/// [`Theme`]: Self::Theme
fn theme(&self, id: Id) -> Self::Theme {
fn theme(&self, _id: Id) -> Self::Theme {
Self::Theme::default()
}

Expand Down Expand Up @@ -98,7 +98,7 @@ pub trait Application: Sized {
/// while a scale factor of `0.5` will shrink them to half their size.
///
/// By default, it returns `1.0`.
fn scale_factor(&self, id: Id) -> f64 {
fn scale_factor(&self, _id: Id) -> f64 {
1.0
}

Expand Down
4 changes: 0 additions & 4 deletions src/wayland/sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ use crate::{
/// fn view(&self, _: Id) -> Element<Self::Message> {
/// "Hello, world!".into()
/// }
///
/// fn close_requested(&self, _: Id) -> Self::Message {
/// unimplemented!()
/// }
/// }
/// ```
pub trait Sandbox {
Expand Down
8 changes: 4 additions & 4 deletions tiny_skia/src/window/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ pub fn present<T: AsRef<str>>(
surface
.window
.resize(
NonZeroU32::new(physical_size.width as u32)
.ok_or_else(|| compositor::SurfaceError::InvalidDimensions)?,
NonZeroU32::new(physical_size.height as u32)
.ok_or_else(|| compositor::SurfaceError::InvalidDimensions)?,
NonZeroU32::new(physical_size.width)
.ok_or(compositor::SurfaceError::InvalidDimensions)?,
NonZeroU32::new(physical_size.height)
.ok_or(compositor::SurfaceError::InvalidDimensions)?,
)
.map_err(|_| compositor::SurfaceError::Resize)?;
if let Ok(mut b) = surface.window.buffer_mut() {
Expand Down
10 changes: 2 additions & 8 deletions winit/src/application.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Create interactive, native cross-platform applications.
mod drag_resize;
#[cfg(feature = "trace")]
mod profiler;
mod state;

#[cfg(feature = "a11y")]
Expand Down Expand Up @@ -918,14 +916,10 @@ pub fn run_command<A, C, E>(
for action in command.actions() {
match action {
command::Action::Future(future) => {
runtime.spawn(Box::pin(
future.map(|e| UserEventWrapper::Message(e)),
));
runtime.spawn(Box::pin(future.map(UserEventWrapper::Message)));
}
command::Action::Stream(stream) => {
runtime.run(Box::pin(
stream.map(|e| UserEventWrapper::Message(e)),
));
runtime.run(Box::pin(stream.map(UserEventWrapper::Message)));
}
command::Action::Clipboard(action) => match action {
clipboard::Action::Read(tag) => {
Expand Down
3 changes: 0 additions & 3 deletions winit/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ pub fn window_event(
WindowEvent::CloseRequested => {
Some(Event::Window(id, window::Event::CloseRequested))
}
WindowEvent::CloseRequested => {
Some(Event::Window(id, window::Event::CloseRequested))
}
WindowEvent::CursorMoved { position, .. } => {
let position = position.to_logical::<f64>(scale_factor);

Expand Down
8 changes: 2 additions & 6 deletions winit/src/multi_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,14 +965,10 @@ fn run_command<A, C, E>(
for action in command.actions() {
match action {
command::Action::Future(future) => {
runtime.spawn(Box::pin(
future.map(|e| UserEventWrapper::Message(e)),
));
runtime.spawn(Box::pin(future.map(UserEventWrapper::Message)));
}
command::Action::Stream(stream) => {
runtime.run(Box::pin(
stream.map(|e| UserEventWrapper::Message(e)),
));
runtime.run(Box::pin(stream.map(UserEventWrapper::Message)));
}
command::Action::Clipboard(action) => match action {
clipboard::Action::Read(tag) => {
Expand Down

0 comments on commit 56b6d65

Please sign in to comment.