diff --git a/crates/eframe/src/epi.rs b/crates/eframe/src/epi.rs index 7a7e9224..fb589fe2 100644 --- a/crates/eframe/src/epi.rs +++ b/crates/eframe/src/epi.rs @@ -878,20 +878,6 @@ pub trait Storage { fn flush(&mut self); } -/// Stores nothing. -#[derive(Clone, Default)] -pub(crate) struct DummyStorage {} - -impl Storage for DummyStorage { - fn get_string(&self, _key: &str) -> Option { - None - } - - fn set_string(&mut self, _key: &str, _value: String) {} - - fn flush(&mut self) {} -} - /// Get and deserialize the [RON](https://github.com/ron-rs/ron) stored at the given key. #[cfg(feature = "ron")] pub fn get_value(storage: &dyn Storage, key: &str) -> Option { diff --git a/crates/eframe/src/native/glow_integration.rs b/crates/eframe/src/native/glow_integration.rs index f17c6ad5..8e932367 100644 --- a/crates/eframe/src/native/glow_integration.rs +++ b/crates/eframe/src/native/glow_integration.rs @@ -344,7 +344,7 @@ impl<'app> GlowWinitApp<'app> { } } -impl<'app> WinitApp for GlowWinitApp<'app> { +impl WinitApp for GlowWinitApp<'_> { fn egui_ctx(&self) -> Option<&egui::Context> { self.running.as_ref().map(|r| &r.integration.egui_ctx) } @@ -479,7 +479,7 @@ impl<'app> WinitApp for GlowWinitApp<'app> { } } -impl<'app> GlowWinitRunning<'app> { +impl GlowWinitRunning<'_> { fn run_ui_and_paint( &mut self, event_loop: &ActiveEventLoop, diff --git a/crates/eframe/src/native/wgpu_integration.rs b/crates/eframe/src/native/wgpu_integration.rs index dc12c52a..f93386f8 100644 --- a/crates/eframe/src/native/wgpu_integration.rs +++ b/crates/eframe/src/native/wgpu_integration.rs @@ -323,7 +323,7 @@ impl<'app> WgpuWinitApp<'app> { } } -impl<'app> WinitApp for WgpuWinitApp<'app> { +impl WinitApp for WgpuWinitApp<'_> { fn egui_ctx(&self) -> Option<&egui::Context> { self.running.as_ref().map(|r| &r.integration.egui_ctx) } @@ -487,7 +487,7 @@ impl<'app> WinitApp for WgpuWinitApp<'app> { } } -impl<'app> WgpuWinitRunning<'app> { +impl WgpuWinitRunning<'_> { fn save_and_destroy(&mut self) { profiling::function_scope!(); diff --git a/crates/egui-wgpu/src/setup.rs b/crates/egui-wgpu/src/setup.rs index 567c0d75..876b0c8e 100644 --- a/crates/egui-wgpu/src/setup.rs +++ b/crates/egui-wgpu/src/setup.rs @@ -55,7 +55,7 @@ impl WgpuSetup { #[cfg(target_arch = "wasm32")] if backends.contains(wgpu::Backends::BROWSER_WEBGPU) { let is_secure_context = - wgpu::web_sys::window().map_or(false, |w| w.is_secure_context()); + wgpu::web_sys::window().is_some_and(|w| w.is_secure_context()); if !is_secure_context { log::info!( "WebGPU is only available in secure contexts, i.e. on HTTPS and on localhost." diff --git a/crates/egui/src/containers/collapsing_header.rs b/crates/egui/src/containers/collapsing_header.rs index 121daeac..c5fa812d 100644 --- a/crates/egui/src/containers/collapsing_header.rs +++ b/crates/egui/src/containers/collapsing_header.rs @@ -283,7 +283,7 @@ pub struct HeaderResponse<'ui, HeaderRet> { header_response: InnerResponse, } -impl<'ui, HeaderRet> HeaderResponse<'ui, HeaderRet> { +impl HeaderResponse<'_, HeaderRet> { pub fn is_open(&self) -> bool { self.state.is_open() } diff --git a/crates/egui/src/containers/scroll_area.rs b/crates/egui/src/containers/scroll_area.rs index 3c14a02e..12702fb2 100644 --- a/crates/egui/src/containers/scroll_area.rs +++ b/crates/egui/src/containers/scroll_area.rs @@ -1184,7 +1184,7 @@ impl Prepared { && ui.input(|i| { i.pointer .latest_pos() - .map_or(false, |p| handle_rect.contains(p)) + .is_some_and(|p| handle_rect.contains(p)) }); let visuals = ui.visuals(); if response.is_pointer_button_down_on() { diff --git a/crates/egui/src/containers/window.rs b/crates/egui/src/containers/window.rs index f1890fee..215f6322 100644 --- a/crates/egui/src/containers/window.rs +++ b/crates/egui/src/containers/window.rs @@ -415,7 +415,7 @@ impl<'open> Window<'open> { } } -impl<'open> Window<'open> { +impl Window<'_> { /// Returns `None` if the window is not open (if [`Window::open`] was called with `&mut false`). /// Returns `Some(InnerResponse { inner: None })` if the window is collapsed. #[inline] diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index 95ae1965..44c807b0 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -211,14 +211,14 @@ impl ContextImpl { fn requested_immediate_repaint_prev_pass(&self, viewport_id: &ViewportId) -> bool { self.viewports .get(viewport_id) - .map_or(false, |v| v.repaint.requested_immediate_repaint_prev_pass()) + .is_some_and(|v| v.repaint.requested_immediate_repaint_prev_pass()) } #[must_use] fn has_requested_repaint(&self, viewport_id: &ViewportId) -> bool { - self.viewports.get(viewport_id).map_or(false, |v| { - 0 < v.repaint.outstanding || v.repaint.repaint_delay < Duration::MAX - }) + self.viewports + .get(viewport_id) + .is_some_and(|v| 0 < v.repaint.outstanding || v.repaint.repaint_delay < Duration::MAX) } } @@ -1214,7 +1214,7 @@ impl Context { #[deprecated = "Use Response.contains_pointer or Context::read_response instead"] pub fn widget_contains_pointer(&self, id: Id) -> bool { self.read_response(id) - .map_or(false, |response| response.contains_pointer()) + .is_some_and(|response| response.contains_pointer()) } /// Do all interaction for an existing widget, without (re-)registering it. @@ -2632,7 +2632,7 @@ impl Context { pub fn is_context_menu_open(&self) -> bool { self.data(|d| { d.get_temp::(menu::CONTEXT_MENU_ID_STR.into()) - .map_or(false, |state| state.has_root()) + .is_some_and(|state| state.has_root()) }) } } diff --git a/crates/egui/src/data/input.rs b/crates/egui/src/data/input.rs index 7987ea61..0bced427 100644 --- a/crates/egui/src/data/input.rs +++ b/crates/egui/src/data/input.rs @@ -986,7 +986,7 @@ impl ModifierNames<'static> { }; } -impl<'a> ModifierNames<'a> { +impl ModifierNames<'_> { pub fn format(&self, modifiers: &Modifiers, is_mac: bool) -> String { let mut s = String::new(); diff --git a/crates/egui/src/data/user_data.rs b/crates/egui/src/data/user_data.rs index 20bf5e1a..12d90adf 100644 --- a/crates/egui/src/data/user_data.rs +++ b/crates/egui/src/data/user_data.rs @@ -54,7 +54,7 @@ impl<'de> serde::Deserialize<'de> for UserData { { struct UserDataVisitor; - impl<'de> serde::de::Visitor<'de> for UserDataVisitor { + impl serde::de::Visitor<'_> for UserDataVisitor { type Value = UserData; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { diff --git a/crates/egui/src/drag_and_drop.rs b/crates/egui/src/drag_and_drop.rs index fc9f29f5..7f0c01b7 100644 --- a/crates/egui/src/drag_and_drop.rs +++ b/crates/egui/src/drag_and_drop.rs @@ -141,7 +141,7 @@ impl DragAndDrop { pub fn has_any_payload(ctx: &Context) -> bool { ctx.data(|data| { let state = data.get_temp::(Id::NULL); - state.map_or(false, |state| state.payload.is_some()) + state.is_some_and(|state| state.payload.is_some()) }) } } diff --git a/crates/egui/src/input_state/mod.rs b/crates/egui/src/input_state/mod.rs index 048e880e..751d635f 100644 --- a/crates/egui/src/input_state/mod.rs +++ b/crates/egui/src/input_state/mod.rs @@ -1303,7 +1303,7 @@ impl PointerState { self.started_decidedly_dragging && !self.has_moved_too_much_for_a_click && self.button_down(PointerButton::Primary) - && self.press_start_time.map_or(false, |press_start_time| { + && self.press_start_time.is_some_and(|press_start_time| { self.time - press_start_time > self.input_options.max_click_duration }) } diff --git a/crates/egui/src/menu.rs b/crates/egui/src/menu.rs index 166e18da..301c69dd 100644 --- a/crates/egui/src/menu.rs +++ b/crates/egui/src/menu.rs @@ -679,7 +679,7 @@ impl MenuState { || self .sub_menu .as_ref() - .map_or(false, |(_, sub)| sub.read().area_contains(pos)) + .is_some_and(|(_, sub)| sub.read().area_contains(pos)) } fn next_entry_index(&mut self) -> usize { diff --git a/crates/egui/src/response.rs b/crates/egui/src/response.rs index 73e77516..f5861f4f 100644 --- a/crates/egui/src/response.rs +++ b/crates/egui/src/response.rs @@ -618,7 +618,7 @@ impl Response { let any_open_popups = self.ctx.prev_pass_state(|fs| { fs.layers .get(&self.layer_id) - .map_or(false, |layer| !layer.open_popups.is_empty()) + .is_some_and(|layer| !layer.open_popups.is_empty()) }); if any_open_popups { // Hide tooltips if the user opens a popup (menu, combo-box, etc) in the same layer. diff --git a/crates/egui/src/text_selection/label_text_selection.rs b/crates/egui/src/text_selection/label_text_selection.rs index e19a40e4..ea5f3c9c 100644 --- a/crates/egui/src/text_selection/label_text_selection.rs +++ b/crates/egui/src/text_selection/label_text_selection.rs @@ -263,7 +263,7 @@ impl LabelSelectionState { let new_text_starts_with_space_or_punctuation = new_text .chars() .next() - .map_or(false, |c| c.is_whitespace() || c.is_ascii_punctuation()); + .is_some_and(|c| c.is_whitespace() || c.is_ascii_punctuation()); if existing_ends_with_space == Some(false) && !new_text_starts_with_space_or_punctuation { diff --git a/crates/egui/src/ui_stack.rs b/crates/egui/src/ui_stack.rs index 7aa131be..550f6b18 100644 --- a/crates/egui/src/ui_stack.rs +++ b/crates/egui/src/ui_stack.rs @@ -229,13 +229,13 @@ impl UiStack { /// Is this [`crate::Ui`] a panel? #[inline] pub fn is_panel_ui(&self) -> bool { - self.kind().map_or(false, |kind| kind.is_panel()) + self.kind().is_some_and(|kind| kind.is_panel()) } /// Is this [`crate::Ui`] an [`crate::Area`]? #[inline] pub fn is_area_ui(&self) -> bool { - self.kind().map_or(false, |kind| kind.is_area()) + self.kind().is_some_and(|kind| kind.is_area()) } /// Is this a root [`crate::Ui`], i.e. created with [`crate::Ui::new()`]? @@ -285,4 +285,4 @@ impl<'a> Iterator for UiStackIterator<'a> { } } -impl<'a> FusedIterator for UiStackIterator<'a> {} +impl FusedIterator for UiStackIterator<'_> {} diff --git a/crates/egui/src/widgets/checkbox.rs b/crates/egui/src/widgets/checkbox.rs index f8b31430..96cc3d22 100644 --- a/crates/egui/src/widgets/checkbox.rs +++ b/crates/egui/src/widgets/checkbox.rs @@ -47,7 +47,7 @@ impl<'a> Checkbox<'a> { } } -impl<'a> Widget for Checkbox<'a> { +impl Widget for Checkbox<'_> { fn ui(self, ui: &mut Ui) -> Response { let Checkbox { checked, diff --git a/crates/egui/src/widgets/drag_value.rs b/crates/egui/src/widgets/drag_value.rs index 175fdcc5..846ab72f 100644 --- a/crates/egui/src/widgets/drag_value.rs +++ b/crates/egui/src/widgets/drag_value.rs @@ -426,7 +426,7 @@ impl<'a> DragValue<'a> { } } -impl<'a> Widget for DragValue<'a> { +impl Widget for DragValue<'_> { fn ui(self, ui: &mut Ui) -> Response { let Self { mut get_set_value, diff --git a/crates/egui/src/widgets/image.rs b/crates/egui/src/widgets/image.rs index d1976a12..2290eabb 100644 --- a/crates/egui/src/widgets/image.rs +++ b/crates/egui/src/widgets/image.rs @@ -372,7 +372,7 @@ impl<'a> Image<'a> { } } -impl<'a> Widget for Image<'a> { +impl Widget for Image<'_> { fn ui(self, ui: &mut Ui) -> Response { let tlr = self.load_for_size(ui.ctx(), ui.available_size()); let original_image_size = tlr.as_ref().ok().and_then(|t| t.size()); @@ -568,7 +568,7 @@ pub enum ImageSource<'a> { }, } -impl<'a> std::fmt::Debug for ImageSource<'a> { +impl std::fmt::Debug for ImageSource<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { ImageSource::Bytes { uri, .. } | ImageSource::Uri(uri) => uri.as_ref().fmt(f), @@ -577,7 +577,7 @@ impl<'a> std::fmt::Debug for ImageSource<'a> { } } -impl<'a> ImageSource<'a> { +impl ImageSource<'_> { /// Size of the texture, if known. #[inline] pub fn texture_size(&self) -> Option { diff --git a/crates/egui/src/widgets/image_button.rs b/crates/egui/src/widgets/image_button.rs index fdcae898..3a03ab29 100644 --- a/crates/egui/src/widgets/image_button.rs +++ b/crates/egui/src/widgets/image_button.rs @@ -71,7 +71,7 @@ impl<'a> ImageButton<'a> { } } -impl<'a> Widget for ImageButton<'a> { +impl Widget for ImageButton<'_> { fn ui(self, ui: &mut Ui) -> Response { let padding = if self.frame { // so we can see that it is a button: diff --git a/crates/egui/src/widgets/label.rs b/crates/egui/src/widgets/label.rs index eb3e3840..67dc196b 100644 --- a/crates/egui/src/widgets/label.rs +++ b/crates/egui/src/widgets/label.rs @@ -244,7 +244,7 @@ impl Widget for Label { // Interactive = the uses asked to sense interaction. // We DON'T want to have the color respond just because the text is selectable; // the cursor is enough to communicate that. - let interactive = self.sense.map_or(false, |sense| sense != Sense::hover()); + let interactive = self.sense.is_some_and(|sense| sense != Sense::hover()); let selectable = self.selectable; diff --git a/crates/egui/src/widgets/slider.rs b/crates/egui/src/widgets/slider.rs index acf0359a..d535a5c7 100644 --- a/crates/egui/src/widgets/slider.rs +++ b/crates/egui/src/widgets/slider.rs @@ -643,7 +643,7 @@ impl<'a> Slider<'a> { } } -impl<'a> Slider<'a> { +impl Slider<'_> { /// Just the slider, no text fn allocate_slider_space(&self, ui: &mut Ui, thickness: f32) -> Response { let desired_size = match self.orientation { @@ -1015,7 +1015,7 @@ impl<'a> Slider<'a> { } } -impl<'a> Widget for Slider<'a> { +impl Widget for Slider<'_> { fn ui(mut self, ui: &mut Ui) -> Response { let inner_response = match self.orientation { SliderOrientation::Horizontal => ui.horizontal(|ui| self.add_contents(ui)), diff --git a/crates/egui/src/widgets/text_edit/builder.rs b/crates/egui/src/widgets/text_edit/builder.rs index 5c3b080f..2619035a 100644 --- a/crates/egui/src/widgets/text_edit/builder.rs +++ b/crates/egui/src/widgets/text_edit/builder.rs @@ -88,11 +88,11 @@ pub struct TextEdit<'t> { background_color: Option, } -impl<'t> WidgetWithState for TextEdit<'t> { +impl WidgetWithState for TextEdit<'_> { type State = TextEditState; } -impl<'t> TextEdit<'t> { +impl TextEdit<'_> { pub fn load_state(ctx: &Context, id: Id) -> Option { TextEditState::load(ctx, id) } @@ -394,13 +394,13 @@ impl<'t> TextEdit<'t> { // ---------------------------------------------------------------------------- -impl<'t> Widget for TextEdit<'t> { +impl Widget for TextEdit<'_> { fn ui(self, ui: &mut Ui) -> Response { self.show(ui).response } } -impl<'t> TextEdit<'t> { +impl TextEdit<'_> { /// Show the [`TextEdit`], returning a rich [`TextEditOutput`]. /// /// ``` diff --git a/crates/egui/src/widgets/text_edit/text_buffer.rs b/crates/egui/src/widgets/text_edit/text_buffer.rs index ea3992c5..31b74632 100644 --- a/crates/egui/src/widgets/text_edit/text_buffer.rs +++ b/crates/egui/src/widgets/text_edit/text_buffer.rs @@ -228,7 +228,7 @@ impl TextBuffer for String { } } -impl<'a> TextBuffer for Cow<'a, str> { +impl TextBuffer for Cow<'_, str> { fn is_mutable(&self) -> bool { true } @@ -259,7 +259,7 @@ impl<'a> TextBuffer for Cow<'a, str> { } /// Immutable view of a `&str`! -impl<'a> TextBuffer for &'a str { +impl TextBuffer for &str { fn is_mutable(&self) -> bool { false } diff --git a/crates/egui_demo_lib/src/demo/text_edit.rs b/crates/egui_demo_lib/src/demo/text_edit.rs index 5ce5c93b..06911957 100644 --- a/crates/egui_demo_lib/src/demo/text_edit.rs +++ b/crates/egui_demo_lib/src/demo/text_edit.rs @@ -58,9 +58,7 @@ impl crate::View for TextEditDemo { } }); - let anything_selected = output - .cursor_range - .map_or(false, |cursor| !cursor.is_empty()); + let anything_selected = output.cursor_range.is_some_and(|cursor| !cursor.is_empty()); ui.add_enabled( anything_selected, diff --git a/crates/egui_extras/src/datepicker/button.rs b/crates/egui_extras/src/datepicker/button.rs index 81a97c12..601c16f6 100644 --- a/crates/egui_extras/src/datepicker/button.rs +++ b/crates/egui_extras/src/datepicker/button.rs @@ -103,7 +103,7 @@ impl<'a> DatePickerButton<'a> { } } -impl<'a> Widget for DatePickerButton<'a> { +impl Widget for DatePickerButton<'_> { fn ui(self, ui: &mut Ui) -> egui::Response { let id = ui.make_persistent_id(self.id_salt); let mut button_state = ui diff --git a/crates/egui_extras/src/datepicker/popup.rs b/crates/egui_extras/src/datepicker/popup.rs index 230b6e0b..8bf2f1a1 100644 --- a/crates/egui_extras/src/datepicker/popup.rs +++ b/crates/egui_extras/src/datepicker/popup.rs @@ -37,7 +37,7 @@ pub(crate) struct DatePickerPopup<'a> { pub highlight_weekends: bool, } -impl<'a> DatePickerPopup<'a> { +impl DatePickerPopup<'_> { /// Returns `true` if user pressed `Save` button. pub fn draw(&mut self, ui: &mut Ui) -> bool { let id = ui.make_persistent_id("date_picker"); diff --git a/crates/egui_extras/src/strip.rs b/crates/egui_extras/src/strip.rs index 9087f673..00fc6577 100644 --- a/crates/egui_extras/src/strip.rs +++ b/crates/egui_extras/src/strip.rs @@ -166,7 +166,7 @@ pub struct Strip<'a, 'b> { size_index: usize, } -impl<'a, 'b> Strip<'a, 'b> { +impl Strip<'_, '_> { #[cfg_attr(debug_assertions, track_caller)] fn next_cell_size(&mut self) -> (CellSize, CellSize) { let size = if let Some(size) = self.sizes.get(self.size_index) { @@ -219,7 +219,7 @@ impl<'a, 'b> Strip<'a, 'b> { } } -impl<'a, 'b> Drop for Strip<'a, 'b> { +impl Drop for Strip<'_, '_> { fn drop(&mut self) { while self.size_index < self.sizes.len() { self.empty(); diff --git a/crates/egui_extras/src/table.rs b/crates/egui_extras/src/table.rs index ec889903..0a6fe690 100644 --- a/crates/egui_extras/src/table.rs +++ b/crates/egui_extras/src/table.rs @@ -698,7 +698,7 @@ pub struct Table<'a> { sense: egui::Sense, } -impl<'a> Table<'a> { +impl Table<'_> { /// Access the contained [`egui::Ui`]. /// /// You can use this to e.g. modify the [`egui::Style`] with [`egui::Ui::style_mut`]. @@ -1228,7 +1228,7 @@ impl<'a> TableBody<'a> { // Capture the hover information for the just created row. This is used in the next render // to ensure that the entire row is highlighted. fn capture_hover_state(&self, response: &Option, row_index: usize) { - let is_row_hovered = response.as_ref().map_or(false, |r| r.hovered()); + let is_row_hovered = response.as_ref().is_some_and(|r| r.hovered()); if is_row_hovered { self.layout .ui @@ -1237,7 +1237,7 @@ impl<'a> TableBody<'a> { } } -impl<'a> Drop for TableBody<'a> { +impl Drop for TableBody<'_> { fn drop(&mut self) { self.layout.allocate_rect(); } @@ -1264,7 +1264,7 @@ pub struct TableRow<'a, 'b> { response: &'b mut Option, } -impl<'a, 'b> TableRow<'a, 'b> { +impl TableRow<'_, '_> { /// Add the contents of a column on this row (i.e. a cell). /// /// Returns the used space (`min_rect`) plus the [`Response`] of the whole cell. @@ -1272,11 +1272,11 @@ impl<'a, 'b> TableRow<'a, 'b> { pub fn col(&mut self, add_cell_contents: impl FnOnce(&mut Ui)) -> (Rect, Response) { let col_index = self.col_index; - let clip = self.columns.get(col_index).map_or(false, |c| c.clip); + let clip = self.columns.get(col_index).is_some_and(|c| c.clip); let auto_size_this_frame = self .columns .get(col_index) - .map_or(false, |c| c.auto_size_this_frame); + .is_some_and(|c| c.auto_size_this_frame); let width = if let Some(width) = self.widths.get(col_index) { self.col_index += 1; @@ -1355,7 +1355,7 @@ impl<'a, 'b> TableRow<'a, 'b> { } } -impl<'a, 'b> Drop for TableRow<'a, 'b> { +impl Drop for TableRow<'_, '_> { #[inline] fn drop(&mut self) { self.layout.end_line(); diff --git a/crates/egui_kittest/src/app_kind.rs b/crates/egui_kittest/src/app_kind.rs index 081490e3..56b94232 100644 --- a/crates/egui_kittest/src/app_kind.rs +++ b/crates/egui_kittest/src/app_kind.rs @@ -21,7 +21,7 @@ pub(crate) enum AppKind<'a, State> { Eframe(AppKindEframe<'a, State>), } -impl<'a, State> AppKind<'a, State> { +impl AppKind<'_, State> { pub fn run( &mut self, ctx: &egui::Context, diff --git a/crates/egui_kittest/src/lib.rs b/crates/egui_kittest/src/lib.rs index dfaad2c9..fdb31372 100644 --- a/crates/egui_kittest/src/lib.rs +++ b/crates/egui_kittest/src/lib.rs @@ -68,7 +68,7 @@ pub struct Harness<'a, State = ()> { step_dt: f32, } -impl<'a, State> Debug for Harness<'a, State> { +impl Debug for Harness<'_, State> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { self.kittest.fmt(f) } @@ -461,7 +461,7 @@ impl<'a> Harness<'a> { } } -impl<'t, 'n, 'h, State> Queryable<'t, 'n> for Harness<'h, State> +impl<'t, 'n, State> Queryable<'t, 'n> for Harness<'_, State> where 'n: 't, { diff --git a/crates/epaint/src/mutex.rs b/crates/epaint/src/mutex.rs index bd984a1d..465722c1 100644 --- a/crates/epaint/src/mutex.rs +++ b/crates/epaint/src/mutex.rs @@ -190,7 +190,7 @@ mod rw_lock_impl { } } - impl<'a, T> Deref for RwLockReadGuard<'a, T> { + impl Deref for RwLockReadGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { @@ -198,7 +198,7 @@ mod rw_lock_impl { } } - impl<'a, T> Drop for RwLockReadGuard<'a, T> { + impl Drop for RwLockReadGuard<'_, T> { fn drop(&mut self) { let tid = std::thread::current().id(); self.holders.lock().remove(&tid); @@ -229,7 +229,7 @@ mod rw_lock_impl { } } - impl<'a, T> Deref for RwLockWriteGuard<'a, T> { + impl Deref for RwLockWriteGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { @@ -237,13 +237,13 @@ mod rw_lock_impl { } } - impl<'a, T> DerefMut for RwLockWriteGuard<'a, T> { + impl DerefMut for RwLockWriteGuard<'_, T> { fn deref_mut(&mut self) -> &mut Self::Target { self.guard.as_mut().unwrap() } } - impl<'a, T> Drop for RwLockWriteGuard<'a, T> { + impl Drop for RwLockWriteGuard<'_, T> { fn drop(&mut self) { let tid = std::thread::current().id(); self.holders.lock().remove(&tid); diff --git a/crates/epaint/src/text/text_layout.rs b/crates/epaint/src/text/text_layout.rs index 2f19e538..4eb5965c 100644 --- a/crates/epaint/src/text/text_layout.rs +++ b/crates/epaint/src/text/text_layout.rs @@ -993,22 +993,22 @@ impl RowBreakCandidates { punctuation, any, } = self; - if space.map_or(false, |s| s < index) { + if space.is_some_and(|s| s < index) { *space = None; } - if cjk.map_or(false, |s| s < index) { + if cjk.is_some_and(|s| s < index) { *cjk = None; } - if pre_cjk.map_or(false, |s| s < index) { + if pre_cjk.is_some_and(|s| s < index) { *pre_cjk = None; } - if dash.map_or(false, |s| s < index) { + if dash.is_some_and(|s| s < index) { *dash = None; } - if punctuation.map_or(false, |s| s < index) { + if punctuation.is_some_and(|s| s < index) { *punctuation = None; } - if any.map_or(false, |s| s < index) { + if any.is_some_and(|s| s < index) { *any = None; } }