Skip to content

Commit 164f56f

Browse files
authored
Fix some clippy issues found by 1.84.0 (emilk#5603)
1 parent 1339639 commit 164f56f

File tree

33 files changed

+65
-81
lines changed

33 files changed

+65
-81
lines changed

crates/eframe/src/epi.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -878,20 +878,6 @@ pub trait Storage {
878878
fn flush(&mut self);
879879
}
880880

881-
/// Stores nothing.
882-
#[derive(Clone, Default)]
883-
pub(crate) struct DummyStorage {}
884-
885-
impl Storage for DummyStorage {
886-
fn get_string(&self, _key: &str) -> Option<String> {
887-
None
888-
}
889-
890-
fn set_string(&mut self, _key: &str, _value: String) {}
891-
892-
fn flush(&mut self) {}
893-
}
894-
895881
/// Get and deserialize the [RON](https://github.com/ron-rs/ron) stored at the given key.
896882
#[cfg(feature = "ron")]
897883
pub fn get_value<T: serde::de::DeserializeOwned>(storage: &dyn Storage, key: &str) -> Option<T> {

crates/eframe/src/native/glow_integration.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ impl<'app> GlowWinitApp<'app> {
344344
}
345345
}
346346

347-
impl<'app> WinitApp for GlowWinitApp<'app> {
347+
impl WinitApp for GlowWinitApp<'_> {
348348
fn egui_ctx(&self) -> Option<&egui::Context> {
349349
self.running.as_ref().map(|r| &r.integration.egui_ctx)
350350
}
@@ -479,7 +479,7 @@ impl<'app> WinitApp for GlowWinitApp<'app> {
479479
}
480480
}
481481

482-
impl<'app> GlowWinitRunning<'app> {
482+
impl GlowWinitRunning<'_> {
483483
fn run_ui_and_paint(
484484
&mut self,
485485
event_loop: &ActiveEventLoop,

crates/eframe/src/native/wgpu_integration.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl<'app> WgpuWinitApp<'app> {
323323
}
324324
}
325325

326-
impl<'app> WinitApp for WgpuWinitApp<'app> {
326+
impl WinitApp for WgpuWinitApp<'_> {
327327
fn egui_ctx(&self) -> Option<&egui::Context> {
328328
self.running.as_ref().map(|r| &r.integration.egui_ctx)
329329
}
@@ -487,7 +487,7 @@ impl<'app> WinitApp for WgpuWinitApp<'app> {
487487
}
488488
}
489489

490-
impl<'app> WgpuWinitRunning<'app> {
490+
impl WgpuWinitRunning<'_> {
491491
fn save_and_destroy(&mut self) {
492492
profiling::function_scope!();
493493

crates/egui-wgpu/src/setup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl WgpuSetup {
5555
#[cfg(target_arch = "wasm32")]
5656
if backends.contains(wgpu::Backends::BROWSER_WEBGPU) {
5757
let is_secure_context =
58-
wgpu::web_sys::window().map_or(false, |w| w.is_secure_context());
58+
wgpu::web_sys::window().is_some_and(|w| w.is_secure_context());
5959
if !is_secure_context {
6060
log::info!(
6161
"WebGPU is only available in secure contexts, i.e. on HTTPS and on localhost."

crates/egui/src/containers/collapsing_header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ pub struct HeaderResponse<'ui, HeaderRet> {
283283
header_response: InnerResponse<HeaderRet>,
284284
}
285285

286-
impl<'ui, HeaderRet> HeaderResponse<'ui, HeaderRet> {
286+
impl<HeaderRet> HeaderResponse<'_, HeaderRet> {
287287
pub fn is_open(&self) -> bool {
288288
self.state.is_open()
289289
}

crates/egui/src/containers/scroll_area.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ impl Prepared {
11841184
&& ui.input(|i| {
11851185
i.pointer
11861186
.latest_pos()
1187-
.map_or(false, |p| handle_rect.contains(p))
1187+
.is_some_and(|p| handle_rect.contains(p))
11881188
});
11891189
let visuals = ui.visuals();
11901190
if response.is_pointer_button_down_on() {

crates/egui/src/containers/window.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl<'open> Window<'open> {
415415
}
416416
}
417417

418-
impl<'open> Window<'open> {
418+
impl Window<'_> {
419419
/// Returns `None` if the window is not open (if [`Window::open`] was called with `&mut false`).
420420
/// Returns `Some(InnerResponse { inner: None })` if the window is collapsed.
421421
#[inline]

crates/egui/src/context.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,14 @@ impl ContextImpl {
211211
fn requested_immediate_repaint_prev_pass(&self, viewport_id: &ViewportId) -> bool {
212212
self.viewports
213213
.get(viewport_id)
214-
.map_or(false, |v| v.repaint.requested_immediate_repaint_prev_pass())
214+
.is_some_and(|v| v.repaint.requested_immediate_repaint_prev_pass())
215215
}
216216

217217
#[must_use]
218218
fn has_requested_repaint(&self, viewport_id: &ViewportId) -> bool {
219-
self.viewports.get(viewport_id).map_or(false, |v| {
220-
0 < v.repaint.outstanding || v.repaint.repaint_delay < Duration::MAX
221-
})
219+
self.viewports
220+
.get(viewport_id)
221+
.is_some_and(|v| 0 < v.repaint.outstanding || v.repaint.repaint_delay < Duration::MAX)
222222
}
223223
}
224224

@@ -1214,7 +1214,7 @@ impl Context {
12141214
#[deprecated = "Use Response.contains_pointer or Context::read_response instead"]
12151215
pub fn widget_contains_pointer(&self, id: Id) -> bool {
12161216
self.read_response(id)
1217-
.map_or(false, |response| response.contains_pointer())
1217+
.is_some_and(|response| response.contains_pointer())
12181218
}
12191219

12201220
/// Do all interaction for an existing widget, without (re-)registering it.
@@ -2632,7 +2632,7 @@ impl Context {
26322632
pub fn is_context_menu_open(&self) -> bool {
26332633
self.data(|d| {
26342634
d.get_temp::<crate::menu::BarState>(menu::CONTEXT_MENU_ID_STR.into())
2635-
.map_or(false, |state| state.has_root())
2635+
.is_some_and(|state| state.has_root())
26362636
})
26372637
}
26382638
}

crates/egui/src/data/input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ impl ModifierNames<'static> {
986986
};
987987
}
988988

989-
impl<'a> ModifierNames<'a> {
989+
impl ModifierNames<'_> {
990990
pub fn format(&self, modifiers: &Modifiers, is_mac: bool) -> String {
991991
let mut s = String::new();
992992

crates/egui/src/data/user_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<'de> serde::Deserialize<'de> for UserData {
5454
{
5555
struct UserDataVisitor;
5656

57-
impl<'de> serde::de::Visitor<'de> for UserDataVisitor {
57+
impl serde::de::Visitor<'_> for UserDataVisitor {
5858
type Value = UserData;
5959

6060
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {

0 commit comments

Comments
 (0)