summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/mouse/click.rs4
-rw-r--r--examples/game_of_life/src/main.rs3
-rw-r--r--examples/integration/src/main.rs6
-rw-r--r--examples/screenshot/src/main.rs15
-rw-r--r--examples/system_information/src/main.rs4
-rw-r--r--examples/todos/src/main.rs3
-rw-r--r--examples/visible_bounds/src/main.rs2
-rw-r--r--futures/src/subscription/tracker.rs3
-rw-r--r--renderer/src/lib.rs2
-rw-r--r--tiny_skia/src/backend.rs6
-rw-r--r--wgpu/src/image/atlas.rs8
-rw-r--r--wgpu/src/image/vector.rs4
-rw-r--r--wgpu/src/triangle.rs2
-rw-r--r--wgpu/src/window/compositor.rs6
-rw-r--r--winit/src/application.rs4
-rw-r--r--winit/src/application/state.rs3
-rw-r--r--winit/src/clipboard.rs5
17 files changed, 35 insertions, 45 deletions
diff --git a/core/src/mouse/click.rs b/core/src/mouse/click.rs
index 4a7d796c..240e5c64 100644
--- a/core/src/mouse/click.rs
+++ b/core/src/mouse/click.rs
@@ -69,8 +69,6 @@ impl Click {
};
self.position == new_position
- && duration
- .map(|duration| duration.as_millis() <= 300)
- .unwrap_or(false)
+ && duration.is_some_and(|duration| duration.as_millis() <= 300)
}
}
diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs
index e451cb06..21a21142 100644
--- a/examples/game_of_life/src/main.rs
+++ b/examples/game_of_life/src/main.rs
@@ -610,8 +610,7 @@ mod grid {
frame.fill_text(Text {
content: format!(
- "{} cell{} @ {:?} ({})",
- cell_count,
+ "{cell_count} cell{} @ {:?} ({})",
if cell_count == 1 { "" } else { "s" },
self.last_tick_duration,
self.last_queued_ticks
diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs
index 7945bd20..243297b2 100644
--- a/examples/integration/src/main.rs
+++ b/examples/integration/src/main.rs
@@ -200,8 +200,10 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
viewport.scale_factor(),
)
})
- .map(mouse::Cursor::Available)
- .unwrap_or(mouse::Cursor::Unavailable),
+ .map_or(
+ mouse::Cursor::Unavailable,
+ mouse::Cursor::Available,
+ ),
&mut renderer,
&Theme::Dark,
&renderer::Style {
diff --git a/examples/screenshot/src/main.rs b/examples/screenshot/src/main.rs
index 68c9d031..d9784dc8 100644
--- a/examples/screenshot/src/main.rs
+++ b/examples/screenshot/src/main.rs
@@ -184,8 +184,8 @@ impl Application for Example {
.align_items(Alignment::Center);
if let Some(crop_error) = &self.crop_error {
- crop_controls = crop_controls
- .push(text(format!("Crop error! \n{}", crop_error)));
+ crop_controls =
+ crop_controls.push(text(format!("Crop error! \n{crop_error}")));
}
let mut controls = column![
@@ -221,9 +221,9 @@ impl Application for Example {
if let Some(png_result) = &self.saved_png_path {
let msg = match png_result {
- Ok(path) => format!("Png saved as: {:?}!", path),
+ Ok(path) => format!("Png saved as: {path:?}!"),
Err(msg) => {
- format!("Png could not be saved due to:\n{:?}", msg)
+ format!("Png could not be saved due to:\n{msg:?}")
}
};
@@ -281,7 +281,7 @@ async fn save_to_png(screenshot: Screenshot) -> Result<String, PngError> {
ColorType::Rgba8,
)
.map(|_| path)
- .map_err(|err| PngError(format!("{:?}", err)))
+ .map_err(|err| PngError(format!("{err:?}")))
}
#[derive(Clone, Debug)]
@@ -293,10 +293,7 @@ fn numeric_input(
) -> Element<'_, Option<u32>> {
text_input(
placeholder,
- &value
- .as_ref()
- .map(ToString::to_string)
- .unwrap_or_else(String::new),
+ &value.as_ref().map_or_else(String::new, ToString::to_string),
)
.on_input(move |text| {
if text.is_empty() {
diff --git a/examples/system_information/src/main.rs b/examples/system_information/src/main.rs
index 633b6e2b..507431ee 100644
--- a/examples/system_information/src/main.rs
+++ b/examples/system_information/src/main.rs
@@ -105,8 +105,8 @@ impl Application for Example {
ByteSize::kb(information.memory_total).to_string();
let memory_total = text(format!(
- "Memory (total): {} kb ({})",
- information.memory_total, memory_readable
+ "Memory (total): {} kb ({memory_readable})",
+ information.memory_total,
));
let memory_text = if let Some(memory_used) =
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index 501bf67e..3048a668 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/src/main.rs
@@ -415,8 +415,7 @@ fn view_controls(tasks: &[Task], current_filter: Filter) -> Element<Message> {
row![
text(format!(
- "{} {} left",
- tasks_left,
+ "{tasks_left} {} left",
if tasks_left == 1 { "task" } else { "tasks" }
))
.width(Length::Fill),
diff --git a/examples/visible_bounds/src/main.rs b/examples/visible_bounds/src/main.rs
index 42dfc24c..697badb4 100644
--- a/examples/visible_bounds/src/main.rs
+++ b/examples/visible_bounds/src/main.rs
@@ -94,7 +94,7 @@ impl Application for Example {
data_row(
label,
match bounds {
- Some(bounds) => format!("{:?}", bounds),
+ Some(bounds) => format!("{bounds:?}"),
None => "not visible".to_string(),
},
if bounds
diff --git a/futures/src/subscription/tracker.rs b/futures/src/subscription/tracker.rs
index 3a83da09..15ed5b87 100644
--- a/futures/src/subscription/tracker.rs
+++ b/futures/src/subscription/tracker.rs
@@ -147,8 +147,7 @@ impl Tracker {
.for_each(|listener| {
if let Err(error) = listener.try_send((event.clone(), status)) {
log::warn!(
- "Error sending event to subscription: {:?}",
- error
+ "Error sending event to subscription: {error:?}"
);
}
});
diff --git a/renderer/src/lib.rs b/renderer/src/lib.rs
index 8bdf231d..ef5c4182 100644
--- a/renderer/src/lib.rs
+++ b/renderer/src/lib.rs
@@ -60,7 +60,7 @@ impl<T> Renderer<T> {
pub fn draw_mesh(&mut self, mesh: Mesh) {
match self {
Self::TinySkia(_) => {
- log::warn!("Unsupported mesh primitive: {:?}", mesh)
+ log::warn!("Unsupported mesh primitive: {mesh:?}")
}
#[cfg(feature = "wgpu")]
Self::Wgpu(renderer) => {
diff --git a/tiny_skia/src/backend.rs b/tiny_skia/src/backend.rs
index c721d96e..65aca4b0 100644
--- a/tiny_skia/src/backend.rs
+++ b/tiny_skia/src/backend.rs
@@ -443,8 +443,7 @@ impl Backend {
#[cfg(not(feature = "image"))]
Primitive::Image { .. } => {
log::warn!(
- "Unsupported primitive in `iced_tiny_skia`: {:?}",
- primitive
+ "Unsupported primitive in `iced_tiny_skia`: {primitive:?}",
);
}
#[cfg(feature = "svg")]
@@ -473,8 +472,7 @@ impl Backend {
#[cfg(not(feature = "svg"))]
Primitive::Svg { .. } => {
log::warn!(
- "Unsupported primitive in `iced_tiny_skia`: {:?}",
- primitive
+ "Unsupported primitive in `iced_tiny_skia`: {primitive:?}",
);
}
Primitive::Custom(primitive::Custom::Fill {
diff --git a/wgpu/src/image/atlas.rs b/wgpu/src/image/atlas.rs
index e3de1290..1253496b 100644
--- a/wgpu/src/image/atlas.rs
+++ b/wgpu/src/image/atlas.rs
@@ -86,7 +86,7 @@ impl Atlas {
entry
};
- log::info!("Allocated atlas entry: {:?}", entry);
+ log::info!("Allocated atlas entry: {entry:?}");
// It is a webgpu requirement that:
// BufferCopyView.layout.bytes_per_row % wgpu::COPY_BYTES_PER_ROW_ALIGNMENT == 0
@@ -139,13 +139,13 @@ impl Atlas {
}
}
- log::info!("Current atlas: {:?}", self);
+ log::info!("Current atlas: {self:?}");
Some(entry)
}
pub fn remove(&mut self, entry: &Entry) {
- log::info!("Removing atlas entry: {:?}", entry);
+ log::info!("Removing atlas entry: {entry:?}");
match entry {
Entry::Contiguous(allocation) => {
@@ -258,7 +258,7 @@ impl Atlas {
}
fn deallocate(&mut self, allocation: &Allocation) {
- log::info!("Deallocating atlas: {:?}", allocation);
+ log::info!("Deallocating atlas: {allocation:?}");
match allocation {
Allocation::Full { layer } => {
diff --git a/wgpu/src/image/vector.rs b/wgpu/src/image/vector.rs
index 2c03d36b..e8baae4f 100644
--- a/wgpu/src/image/vector.rs
+++ b/wgpu/src/image/vector.rs
@@ -56,7 +56,7 @@ impl Cache {
.ok()
});
- tree.map(Svg::Loaded).unwrap_or(Svg::NotFound)
+ tree.map_or(Svg::NotFound, Svg::Loaded)
}
svg::Data::Bytes(bytes) => {
match usvg::Tree::from_data(bytes, &usvg::Options::default()) {
@@ -152,7 +152,7 @@ impl Cache {
let allocation =
atlas.upload(device, encoder, width, height, &rgba)?;
- log::debug!("allocating {} {}x{}", id, width, height);
+ log::debug!("allocating {id} {width}x{height}");
let _ = self.svg_hits.insert(id);
let _ = self.rasterized_hits.insert(key);
diff --git a/wgpu/src/triangle.rs b/wgpu/src/triangle.rs
index d430e607..7e1bd9cc 100644
--- a/wgpu/src/triangle.rs
+++ b/wgpu/src/triangle.rs
@@ -349,7 +349,7 @@ fn multisample_state(
antialiasing: Option<Antialiasing>,
) -> wgpu::MultisampleState {
wgpu::MultisampleState {
- count: antialiasing.map(|a| a.sample_count()).unwrap_or(1),
+ count: antialiasing.map_or(1, Antialiasing::sample_count),
mask: !0,
alpha_to_coverage_enabled: false,
}
diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs
index a9521a15..1ddbe5fe 100644
--- a/wgpu/src/window/compositor.rs
+++ b/wgpu/src/window/compositor.rs
@@ -35,7 +35,7 @@ impl<Theme> Compositor<Theme> {
..Default::default()
});
- log::info!("{:#?}", settings);
+ log::info!("{settings:#?}");
#[cfg(not(target_arch = "wasm32"))]
if log::max_level() >= log::LevelFilter::Info {
@@ -43,7 +43,7 @@ impl<Theme> Compositor<Theme> {
.enumerate_adapters(settings.internal_backend)
.map(|adapter| adapter.get_info())
.collect();
- log::info!("Available adapters: {:#?}", available_adapters);
+ log::info!("Available adapters: {available_adapters:#?}");
}
#[allow(unsafe_code)]
@@ -83,7 +83,7 @@ impl<Theme> Compositor<Theme> {
})
})?;
- log::info!("Selected format: {:?}", format);
+ log::info!("Selected format: {format:?}");
#[cfg(target_arch = "wasm32")]
let limits = [wgpu::Limits::downlevel_webgl2_defaults()
diff --git a/winit/src/application.rs b/winit/src/application.rs
index d1689452..dec77e80 100644
--- a/winit/src/application.rs
+++ b/winit/src/application.rs
@@ -157,7 +157,7 @@ where
)
.with_visible(false);
- log::debug!("Window builder: {:#?}", builder);
+ log::debug!("Window builder: {builder:#?}");
let window = builder
.build(&event_loop)
@@ -174,7 +174,7 @@ where
let body = document.body().unwrap();
let target = target.and_then(|target| {
- body.query_selector(&format!("#{}", target))
+ body.query_selector(&format!("#{target}"))
.ok()
.unwrap_or(None)
});
diff --git a/winit/src/application/state.rs b/winit/src/application/state.rs
index e655529a..9d1d5dcf 100644
--- a/winit/src/application/state.rs
+++ b/winit/src/application/state.rs
@@ -97,8 +97,7 @@ where
self.viewport.scale_factor(),
)
})
- .map(mouse::Cursor::Available)
- .unwrap_or(mouse::Cursor::Unavailable)
+ .map_or(mouse::Cursor::Unavailable, mouse::Cursor::Available)
}
/// Returns the current keyboard modifiers of the [`State`].
diff --git a/winit/src/clipboard.rs b/winit/src/clipboard.rs
index 7271441d..4228e46f 100644
--- a/winit/src/clipboard.rs
+++ b/winit/src/clipboard.rs
@@ -17,8 +17,7 @@ impl Clipboard {
pub fn connect(window: &winit::window::Window) -> Clipboard {
let state = window_clipboard::Clipboard::connect(window)
.ok()
- .map(State::Connected)
- .unwrap_or(State::Unavailable);
+ .map_or(State::Unavailable, State::Connected);
Clipboard { state }
}
@@ -45,7 +44,7 @@ impl Clipboard {
State::Connected(clipboard) => match clipboard.write(contents) {
Ok(()) => {}
Err(error) => {
- log::warn!("error writing to clipboard: {}", error)
+ log::warn!("error writing to clipboard: {error}")
}
},
State::Unavailable => {}