1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00

Fix some clippy issues found by 1.84.0 (#5603)

This commit is contained in:
Emil Ernerfeldt
2025-01-13 08:29:13 +01:00
committed by GitHub
parent 1339639706
commit 164f56f554
33 changed files with 65 additions and 81 deletions

View File

@@ -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

View File

@@ -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");

View File

@@ -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();

View File

@@ -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<Response>, 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<Response>,
}
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();