1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

clippy +nightly fix (#7723)

This commit is contained in:
Emil Ernerfeldt
2025-11-17 05:10:43 +01:00
committed by GitHub
parent 01770be13e
commit dc0acd2dd1
7 changed files with 11 additions and 13 deletions

View File

@@ -161,14 +161,13 @@ impl MenuState {
if state.last_visible_pass + 1 < pass_nr { if state.last_visible_pass + 1 < pass_nr {
state.open_item = None; state.open_item = None;
} }
if let Some(item) = state.open_item { if let Some(item) = state.open_item
if data && data
.get_temp(item.with(Self::ID)) .get_temp(item.with(Self::ID))
.is_none_or(|item: Self| item.last_visible_pass + 1 < pass_nr) .is_none_or(|item: Self| item.last_visible_pass + 1 < pass_nr)
{ {
// If the open item wasn't shown for at least a frame, reset the open item // If the open item wasn't shown for at least a frame, reset the open item
state.open_item = None; state.open_item = None;
}
} }
let r = f(&mut state); let r = f(&mut state);
data.insert_temp(state_id, state); data.insert_temp(state_id, state);

View File

@@ -1272,8 +1272,7 @@ impl Areas {
pub fn top_layer_id(&self, order: Order) -> Option<LayerId> { pub fn top_layer_id(&self, order: Order) -> Option<LayerId> {
self.order self.order
.iter() .iter()
.filter(|layer| layer.order == order && !self.is_sublayer(layer)) .rfind(|layer| layer.order == order && !self.is_sublayer(layer))
.next_back()
.copied() .copied()
} }

View File

@@ -634,7 +634,7 @@ impl SubMenu {
/// Usually you don't need to use it directly. /// Usually you don't need to use it directly.
pub struct MenuState { pub struct MenuState {
/// The opened sub-menu and its [`Id`] /// The opened sub-menu and its [`Id`]
sub_menu: Option<(Id, Arc<RwLock<MenuState>>)>, sub_menu: Option<(Id, Arc<RwLock<Self>>)>,
/// Bounding box of this menu (without the sub-menu), /// Bounding box of this menu (without the sub-menu),
/// including the frame and everything. /// including the frame and everything.

View File

@@ -209,7 +209,7 @@ pub struct UiStack {
pub layout_direction: Direction, pub layout_direction: Direction,
pub min_rect: Rect, pub min_rect: Rect,
pub max_rect: Rect, pub max_rect: Rect,
pub parent: Option<Arc<UiStack>>, pub parent: Option<Arc<Self>>,
} }
// these methods act on this specific node // these methods act on this specific node

View File

@@ -451,7 +451,7 @@ enum Action {
#[derive(Clone, Default)] #[derive(Clone, Default)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
struct Tree(Vec<Tree>); struct Tree(Vec<Self>);
impl Tree { impl Tree {
pub fn demo() -> Self { pub fn demo() -> Self {

View File

@@ -30,7 +30,7 @@ pub enum Shape {
/// Recursively nest more shapes - sometimes a convenience to be able to do. /// Recursively nest more shapes - sometimes a convenience to be able to do.
/// For performance reasons it is better to avoid it. /// For performance reasons it is better to avoid it.
Vec(Vec<Shape>), Vec(Vec<Self>),
/// Circle with optional outline and fill. /// Circle with optional outline and fill.
Circle(CircleShape), Circle(CircleShape),

View File

@@ -31,7 +31,7 @@ pub struct ViewportState {
pub visible: bool, pub visible: bool,
pub immediate: bool, pub immediate: bool,
pub title: String, pub title: String,
pub children: Vec<Arc<RwLock<ViewportState>>>, pub children: Vec<Arc<RwLock<Self>>>,
} }
impl ViewportState { impl ViewportState {