Skip to content

Commit 74fa6a9

Browse files
committed
Simplify context lifetimes
1 parent d631217 commit 74fa6a9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

druid/src/contexts.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ pub struct UpdateCtx<'a, 'b> {
8484
/// As of now, the main service provided is access to a factory for
8585
/// creating text layout objects, which are likely to be useful
8686
/// during widget layout.
87-
pub struct LayoutCtx<'a, 'b: 'a, 'c> {
88-
pub(crate) root_state: &'a mut ContextState<'c>,
87+
pub struct LayoutCtx<'a, 'b, 'c: 'a> {
88+
pub(crate) root_state: &'a mut ContextState<'b>,
8989
pub(crate) widget_state: &'a mut WidgetState,
90-
pub(crate) text_factory: &'a mut Text<'b>,
90+
pub(crate) text_factory: &'a mut Text<'c>,
9191
pub(crate) mouse_pos: Option<Point>,
9292
}
9393

@@ -105,7 +105,7 @@ pub(crate) struct ZOrderPaintOp {
105105
/// This struct is expected to grow, for example to include the
106106
/// "damage region" indicating that only a subset of the entire
107107
/// widget hierarchy needs repainting.
108-
pub struct PaintCtx<'a, 'b: 'a> {
108+
pub struct PaintCtx<'a, 'b> {
109109
/// The render context for actually painting.
110110
pub render_ctx: &'a mut Piet<'b>,
111111
pub window_id: WindowId,
@@ -128,7 +128,7 @@ pub struct PaintCtx<'a, 'b: 'a> {
128128
#[derive(Debug, Clone)]
129129
pub struct Region(Rect);
130130

131-
impl<'a, 'b> EventCtx<'a, 'b> {
131+
impl EventCtx<'_, '_> {
132132
#[deprecated(since = "0.5.0", note = "use request_paint instead")]
133133
pub fn invalidate(&mut self) {
134134
self.request_paint();
@@ -454,7 +454,7 @@ impl<'a, 'b> EventCtx<'a, 'b> {
454454
}
455455
}
456456

457-
impl<'a, 'b> LifeCycleCtx<'a, 'b> {
457+
impl LifeCycleCtx<'_, '_> {
458458
#[deprecated(since = "0.5.0", note = "use request_paint instead")]
459459
pub fn invalidate(&mut self) {
460460
self.request_paint();
@@ -688,9 +688,9 @@ impl<'a, 'b> UpdateCtx<'a, 'b> {
688688
}
689689
}
690690

691-
impl<'a, 'b, 'c> LayoutCtx<'a, 'b, 'c> {
691+
impl<'c> LayoutCtx<'_, '_, 'c> {
692692
/// Get an object which can create text layouts.
693-
pub fn text(&mut self) -> &mut Text<'b> {
693+
pub fn text(&mut self) -> &mut Text<'c> {
694694
&mut self.text_factory
695695
}
696696

@@ -715,7 +715,7 @@ impl<'a, 'b, 'c> LayoutCtx<'a, 'b, 'c> {
715715
}
716716
}
717717

718-
impl<'a, 'b: 'a> PaintCtx<'a, 'b> {
718+
impl PaintCtx<'_, '_> {
719719
/// get the `WidgetId` of the current widget.
720720
pub fn widget_id(&self) -> WidgetId {
721721
self.widget_state.id

0 commit comments

Comments
 (0)