Remove unnecessary lifetime in `Widget` trait

This commit is contained in:
Héctor Ramón Jiménez 2020-07-10 02:01:30 +02:00
parent f24e03eae8
commit dc0e423142
24 changed files with 32 additions and 34 deletions

View File

@ -25,7 +25,7 @@ mod circle {
}
}
impl<'a, Message, B> Widget<'a, Message, Renderer<B>> for Circle
impl<Message, B> Widget<Message, Renderer<B>> for Circle
where
B: Backend,
{

View File

@ -27,7 +27,7 @@ mod rainbow {
}
}
impl<'a, Message, B> Widget<'a, Message, Renderer<B>> for Rainbow
impl<Message, B> Widget<Message, Renderer<B>> for Rainbow
where
B: Backend,
{

View File

@ -93,7 +93,7 @@ where
fn explain<Message>(
&mut self,
defaults: &Defaults,
widget: &dyn Widget<'_, Message, Self>,
widget: &dyn Widget<Message, Self>,
layout: Layout<'_>,
cursor_position: Point,
color: Color,

View File

@ -134,7 +134,7 @@ impl<Message, P: Program<Message>> Canvas<Message, P> {
}
}
impl<'a, Message, P, B> Widget<'a, Message, Renderer<B>> for Canvas<Message, P>
impl<Message, P, B> Widget<Message, Renderer<B>> for Canvas<Message, P>
where
P: Program<Message>,
B: Backend,

View File

@ -17,7 +17,7 @@ use std::rc::Rc;
/// [`Element`]: struct.Element.html
#[allow(missing_debug_implementations)]
pub struct Element<'a, Message, Renderer> {
pub(crate) widget: Box<dyn Widget<'a, Message, Renderer> + 'a>,
pub(crate) widget: Box<dyn Widget<Message, Renderer> + 'a>,
}
impl<'a, Message, Renderer> Element<'a, Message, Renderer>
@ -29,7 +29,7 @@ where
/// [`Element`]: struct.Element.html
/// [`Widget`]: widget/trait.Widget.html
pub fn new(
widget: impl Widget<'a, Message, Renderer> + 'a,
widget: impl Widget<Message, Renderer> + 'a,
) -> Element<'a, Message, Renderer> {
Element {
widget: Box::new(widget),
@ -282,13 +282,13 @@ where
}
struct Map<'a, A, B, Renderer> {
widget: Box<dyn Widget<'a, A, Renderer> + 'a>,
widget: Box<dyn Widget<A, Renderer> + 'a>,
mapper: Rc<dyn Fn(A) -> B>,
}
impl<'a, A, B, Renderer> Map<'a, A, B, Renderer> {
pub fn new<F>(
widget: Box<dyn Widget<'a, A, Renderer> + 'a>,
widget: Box<dyn Widget<A, Renderer> + 'a>,
mapper: F,
) -> Map<'a, A, B, Renderer>
where
@ -301,7 +301,7 @@ impl<'a, A, B, Renderer> Map<'a, A, B, Renderer> {
}
}
impl<'a, A, B, Renderer> Widget<'a, B, Renderer> for Map<'a, A, B, Renderer>
impl<'a, A, B, Renderer> Widget<B, Renderer> for Map<'a, A, B, Renderer>
where
Renderer: crate::Renderer + 'a,
A: 'static,
@ -389,7 +389,7 @@ where
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer>
impl<'a, Message, Renderer> Widget<Message, Renderer>
for Explain<'a, Message, Renderer>
where
Renderer: crate::Renderer + layout::Debugger,

View File

@ -18,7 +18,7 @@ pub trait Debugger: Renderer {
fn explain<Message>(
&mut self,
defaults: &Self::Defaults,
widget: &dyn Widget<'_, Message, Self>,
widget: &dyn Widget<Message, Self>,
layout: Layout<'_>,
cursor_position: Point,
color: Color,

View File

@ -260,7 +260,7 @@ struct List<'a, T, Message, Renderer: self::Renderer> {
style: <Renderer as self::Renderer>::Style,
}
impl<'a, T, Message, Renderer: self::Renderer> Widget<'a, Message, Renderer>
impl<'a, T, Message, Renderer: self::Renderer> Widget<Message, Renderer>
for List<'a, T, Message, Renderer>
where
T: Clone + ToString,

View File

@ -97,7 +97,7 @@ use crate::{layout, overlay, Clipboard, Event, Hasher, Layout, Length, Point};
/// [`geometry`]: https://github.com/hecrj/iced/tree/0.1/examples/geometry
/// [`lyon`]: https://github.com/nical/lyon
/// [`iced_wgpu`]: https://github.com/hecrj/iced/tree/0.1/wgpu
pub trait Widget<'a, Message, Renderer>
pub trait Widget<Message, Renderer>
where
Renderer: crate::Renderer,
{
@ -179,10 +179,10 @@ where
) {
}
fn overlay<'b>(
&'b mut self,
fn overlay(
&mut self,
_layout: Layout<'_>,
) -> Option<overlay::Element<'b, Message, Renderer>> {
) -> Option<overlay::Element<'_, Message, Renderer>> {
None
}
}

View File

@ -139,7 +139,7 @@ impl State {
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer>
impl<'a, Message, Renderer> Widget<Message, Renderer>
for Button<'a, Message, Renderer>
where
Renderer: self::Renderer,

View File

@ -106,7 +106,7 @@ impl<Message, Renderer: self::Renderer + text::Renderer>
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer>
impl<Message, Renderer> Widget<Message, Renderer>
for Checkbox<Message, Renderer>
where
Renderer: self::Renderer + text::Renderer + row::Renderer,

View File

@ -121,7 +121,7 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> {
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer>
impl<'a, Message, Renderer> Widget<Message, Renderer>
for Column<'a, Message, Renderer>
where
Renderer: self::Renderer,

View File

@ -93,7 +93,7 @@ where
}
}
impl<'a, T: 'a, Message, Renderer> Widget<'a, Message, Renderer>
impl<'a, T: 'a, Message, Renderer> Widget<Message, Renderer>
for ComboBox<'a, T, Message, Renderer>
where
T: Clone + ToString + Eq,

View File

@ -129,7 +129,7 @@ where
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer>
impl<'a, Message, Renderer> Widget<Message, Renderer>
for Container<'a, Message, Renderer>
where
Renderer: self::Renderer,

View File

@ -54,7 +54,7 @@ impl Image {
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer> for Image
impl<Message, Renderer> Widget<Message, Renderer> for Image
where
Renderer: self::Renderer,
{

View File

@ -402,7 +402,7 @@ pub struct KeyPressEvent {
pub modifiers: keyboard::ModifiersState,
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer>
impl<'a, Message, Renderer> Widget<Message, Renderer>
for PaneGrid<'a, Message, Renderer>
where
Renderer: self::Renderer + container::Renderer,

View File

@ -70,8 +70,7 @@ impl<Renderer: self::Renderer> ProgressBar<Renderer> {
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer>
for ProgressBar<Renderer>
impl<Message, Renderer> Widget<Message, Renderer> for ProgressBar<Renderer>
where
Renderer: self::Renderer,
{

View File

@ -121,8 +121,7 @@ impl<Message, Renderer: self::Renderer + text::Renderer>
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer>
for Radio<Message, Renderer>
impl<Message, Renderer> Widget<Message, Renderer> for Radio<Message, Renderer>
where
Renderer: self::Renderer + text::Renderer + row::Renderer,
Message: Clone,

View File

@ -122,7 +122,7 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer>
impl<'a, Message, Renderer> Widget<Message, Renderer>
for Row<'a, Message, Renderer>
where
Renderer: self::Renderer,

View File

@ -110,7 +110,7 @@ impl<'a, Message, Renderer: self::Renderer> Scrollable<'a, Message, Renderer> {
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer>
impl<'a, Message, Renderer> Widget<Message, Renderer>
for Scrollable<'a, Message, Renderer>
where
Renderer: self::Renderer,

View File

@ -154,7 +154,7 @@ impl State {
}
}
impl<'a, T, Message, Renderer> Widget<'a, Message, Renderer>
impl<'a, T, Message, Renderer> Widget<Message, Renderer>
for Slider<'a, T, Message, Renderer>
where
T: Copy + Into<f64> + num_traits::FromPrimitive,

View File

@ -43,7 +43,7 @@ impl Space {
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer> for Space
impl<Message, Renderer> Widget<Message, Renderer> for Space
where
Renderer: self::Renderer,
{

View File

@ -60,7 +60,7 @@ impl Svg {
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer> for Svg
impl<Message, Renderer> Widget<Message, Renderer> for Svg
where
Renderer: self::Renderer,
{

View File

@ -112,7 +112,7 @@ impl<Renderer: self::Renderer> Text<Renderer> {
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer> for Text<Renderer>
impl<Message, Renderer> Widget<Message, Renderer> for Text<Renderer>
where
Renderer: self::Renderer,
{

View File

@ -165,7 +165,7 @@ impl<'a, Message, Renderer: self::Renderer> TextInput<'a, Message, Renderer> {
}
}
impl<'a, Message, Renderer> Widget<'a, Message, Renderer>
impl<'a, Message, Renderer> Widget<Message, Renderer>
for TextInput<'a, Message, Renderer>
where
Renderer: self::Renderer,