From 58f318550dedaec6ed901c83131e424cf39ee648 Mon Sep 17 00:00:00 2001 From: Alphyr <47725341+a1phyr@users.noreply.github.com> Date: Mon, 28 Mar 2022 15:00:09 +0200 Subject: [PATCH] Fix clippy lints (#2560) --- wgpu-core/src/device/life.rs | 2 +- wgpu-core/src/init_tracker/mod.rs | 3 +-- wgpu/examples/framework.rs | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/wgpu-core/src/device/life.rs b/wgpu-core/src/device/life.rs index 9c295db04..21efcb425 100644 --- a/wgpu-core/src/device/life.rs +++ b/wgpu-core/src/device/life.rs @@ -374,7 +374,7 @@ impl LifetimeTracker { .active .iter() .position(|a| a.index > last_done) - .unwrap_or_else(|| self.active.len()); + .unwrap_or(self.active.len()); let mut work_done_closures = SmallVec::new(); for a in self.active.drain(..done_count) { diff --git a/wgpu-core/src/init_tracker/mod.rs b/wgpu-core/src/init_tracker/mod.rs index b5c616024..1111735f6 100644 --- a/wgpu-core/src/init_tracker/mod.rs +++ b/wgpu-core/src/init_tracker/mod.rs @@ -142,7 +142,7 @@ where .partition_point(|r| r.end <= query_range.start); self.uninitialized_ranges .get(index) - .map(|start_range| { + .and_then(|start_range| { if start_range.start < query_range.end { let start = start_range.start.max(query_range.start); match self.uninitialized_ranges.get(index + 1) { @@ -160,7 +160,6 @@ where None } }) - .flatten() } // Drains uninitialized ranges in a query range. diff --git a/wgpu/examples/framework.rs b/wgpu/examples/framework.rs index 08dc16ad7..0ed135f1c 100644 --- a/wgpu/examples/framework.rs +++ b/wgpu/examples/framework.rs @@ -95,8 +95,7 @@ async fn setup(title: &str) -> Setup { use winit::platform::web::WindowExtWebSys; let query_string = web_sys::window().unwrap().location().search().unwrap(); let level: log::Level = parse_url_query_string(&query_string, "RUST_LOG") - .map(|x| x.parse().ok()) - .flatten() + .and_then(|x| x.parse().ok()) .unwrap_or(log::Level::Error); console_log::init_with_level(level).expect("could not initialize logger"); std::panic::set_hook(Box::new(console_error_panic_hook::hook));