Skip to content

Commit

Permalink
Fix new clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Dec 2, 2024
1 parent e8f8216 commit 6026613
Show file tree
Hide file tree
Showing 48 changed files with 123 additions and 122 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[alias]
lint = "clippy --workspace --benches --all-features --no-deps -- -D warnings"
lint-fix = "clippy --fix --allow-dirty --workspace --benches --all-features --no-deps -- -D warnings"
4 changes: 2 additions & 2 deletions core/src/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ where
}
}

impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Explain<'a, Message, Theme, Renderer>
impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Explain<'_, Message, Theme, Renderer>
where
Renderer: crate::Renderer,
{
Expand Down
10 changes: 5 additions & 5 deletions core/src/overlay/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ impl<'a, A, B, Theme, Renderer> Map<'a, A, B, Theme, Renderer> {
}
}

impl<'a, A, B, Theme, Renderer> Overlay<B, Theme, Renderer>
for Map<'a, A, B, Theme, Renderer>
impl<A, B, Theme, Renderer> Overlay<B, Theme, Renderer>
for Map<'_, A, B, Theme, Renderer>
where
Renderer: crate::Renderer,
{
Expand Down Expand Up @@ -203,11 +203,11 @@ where
self.content.is_over(layout, renderer, cursor_position)
}

fn overlay<'b>(
&'b mut self,
fn overlay<'a>(
&'a mut self,
layout: Layout<'_>,
renderer: &Renderer,
) -> Option<Element<'b, B, Theme, Renderer>> {
) -> Option<Element<'a, B, Theme, Renderer>> {
self.content
.overlay(layout, renderer)
.map(|overlay| overlay.map(self.mapper))
Expand Down
10 changes: 5 additions & 5 deletions core/src/overlay/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ where
}
}

impl<'a, Message, Theme, Renderer> Overlay<Message, Theme, Renderer>
for Group<'a, Message, Theme, Renderer>
impl<Message, Theme, Renderer> Overlay<Message, Theme, Renderer>
for Group<'_, Message, Theme, Renderer>
where
Renderer: crate::Renderer,
{
Expand Down Expand Up @@ -152,11 +152,11 @@ where
})
}

fn overlay<'b>(
&'b mut self,
fn overlay<'a>(
&'a mut self,
layout: Layout<'_>,
renderer: &Renderer,
) -> Option<overlay::Element<'b, Message, Theme, Renderer>> {
) -> Option<overlay::Element<'a, Message, Theme, Renderer>> {
let children = self
.children
.iter_mut()
Expand Down
4 changes: 2 additions & 2 deletions core/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ impl<'a, Link, Font> From<&'a str> for Span<'a, Link, Font> {
}
}

impl<'a, Link, Font: PartialEq> PartialEq for Span<'a, Link, Font> {
impl<Link, Font: PartialEq> PartialEq for Span<'_, Link, Font> {
fn eq(&self, other: &Self) -> bool {
self.text == other.text
&& self.size == other.size
Expand Down Expand Up @@ -474,7 +474,7 @@ impl<'a> IntoFragment<'a> for Fragment<'a> {
}
}

impl<'a, 'b> IntoFragment<'a> for &'a Fragment<'b> {
impl<'a> IntoFragment<'a> for &'a Fragment<'_> {
fn into_fragment(self) -> Fragment<'a> {
Fragment::Borrowed(self)
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/widget/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ where
operation: &'a mut dyn Operation<T>,
}

impl<'a, T, O> Operation<O> for BlackBox<'a, T> {
impl<T, O> Operation<O> for BlackBox<'_, T> {
fn container(
&mut self,
id: Option<&Id>,
Expand Down Expand Up @@ -218,7 +218,7 @@ where
operation: &'a mut dyn Operation<A>,
}

impl<'a, A, B> Operation<B> for MapRef<'a, A> {
impl<A, B> Operation<B> for MapRef<'_, A> {
fn container(
&mut self,
id: Option<&Id>,
Expand Down
4 changes: 2 additions & 2 deletions core/src/widget/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ where
#[derive(Debug, Default)]
pub struct State<P: Paragraph>(pub paragraph::Plain<P>);

impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Text<'a, Theme, Renderer>
impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Text<'_, Theme, Renderer>
where
Theme: Catalog,
Renderer: text::Renderer,
Expand Down
2 changes: 1 addition & 1 deletion examples/bezier_tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ mod bezier {
curves: &'a [Curve],
}

impl<'a> canvas::Program<Curve> for Bezier<'a> {
impl canvas::Program<Curve> for Bezier<'_> {
type State = Option<Pending>;

fn update(
Expand Down
2 changes: 1 addition & 1 deletion examples/custom_quad/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mod quad {
}
}

impl<'a, Message> From<CustomQuad> for Element<'a, Message> {
impl<Message> From<CustomQuad> for Element<'_, Message> {
fn from(circle: CustomQuad) -> Self {
Self::new(circle)
}
Expand Down
4 changes: 2 additions & 2 deletions examples/custom_widget/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ mod circle {
}
}

impl<'a, Message, Theme, Renderer> From<Circle>
for Element<'a, Message, Theme, Renderer>
impl<Message, Theme, Renderer> From<Circle>
for Element<'_, Message, Theme, Renderer>
where
Renderer: renderer::Renderer,
{
Expand Down
2 changes: 1 addition & 1 deletion examples/geometry/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ mod rainbow {
}
}

impl<'a, Message> From<Rainbow> for Element<'a, Message> {
impl<Message> From<Rainbow> for Element<'_, Message> {
fn from(rainbow: Rainbow) -> Self {
Self::new(rainbow)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/loading_spinners/src/circular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ where
}
}

impl<'a, Theme> Default for Circular<'a, Theme>
impl<Theme> Default for Circular<'_, Theme>
where
Theme: StyleSheet,
{
Expand Down
2 changes: 1 addition & 1 deletion examples/loading_spinners/src/linear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ where
}
}

impl<'a, Theme> Default for Linear<'a, Theme>
impl<Theme> Default for Linear<'_, Theme>
where
Theme: StyleSheet,
{
Expand Down
2 changes: 1 addition & 1 deletion examples/loupe/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ mod loupe {
content: Element<'a, Message>,
}

impl<'a, Message> Widget<Message, Theme, Renderer> for Loupe<'a, Message> {
impl<Message> Widget<Message, Theme, Renderer> for Loupe<'_, Message> {
fn tag(&self) -> widget::tree::Tag {
self.content.as_widget().tag()
}
Expand Down
6 changes: 3 additions & 3 deletions examples/toast/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ mod toast {
}
}

impl<'a, Message> Widget<Message, Theme, Renderer> for Manager<'a, Message> {
impl<Message> Widget<Message, Theme, Renderer> for Manager<'_, Message> {
fn size(&self) -> Size<Length> {
self.content.as_widget().size()
}
Expand Down Expand Up @@ -464,8 +464,8 @@ mod toast {
timeout_secs: u64,
}

impl<'a, 'b, Message> overlay::Overlay<Message, Theme, Renderer>
for Overlay<'a, 'b, Message>
impl<Message> overlay::Overlay<Message, Theme, Renderer>
for Overlay<'_, '_, Message>
{
fn layout(
&mut self,
Expand Down
4 changes: 2 additions & 2 deletions graphics/src/geometry/stroke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct Stroke<'a> {
pub line_dash: LineDash<'a>,
}

impl<'a> Stroke<'a> {
impl Stroke<'_> {
/// Sets the color of the [`Stroke`].
pub fn with_color(self, color: Color) -> Self {
Stroke {
Expand All @@ -48,7 +48,7 @@ impl<'a> Stroke<'a> {
}
}

impl<'a> Default for Stroke<'a> {
impl Default for Stroke<'_> {
fn default() -> Self {
Stroke {
style: Style::Solid(Color::BLACK),
Expand Down
2 changes: 1 addition & 1 deletion widget/src/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ enum OnPress<'a, Message> {
Closure(Box<dyn Fn() -> Message + 'a>),
}

impl<'a, Message: Clone> OnPress<'a, Message> {
impl<Message: Clone> OnPress<'_, Message> {
fn get(&self) -> Message {
match self {
OnPress::Direct(message) => message.clone(),
Expand Down
4 changes: 2 additions & 2 deletions widget/src/checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ where
}
}

impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Checkbox<'a, Message, Theme, Renderer>
impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Checkbox<'_, Message, Theme, Renderer>
where
Renderer: text::Renderer,
Theme: Catalog,
Expand Down
6 changes: 3 additions & 3 deletions widget/src/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ where
}
}

impl<'a, Message, Renderer> Default for Column<'a, Message, Renderer>
impl<Message, Renderer> Default for Column<'_, Message, Renderer>
where
Renderer: crate::core::Renderer,
{
Expand All @@ -195,8 +195,8 @@ impl<'a, Message, Theme, Renderer: crate::core::Renderer>
}
}

impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Column<'a, Message, Theme, Renderer>
impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Column<'_, Message, Theme, Renderer>
where
Renderer: crate::core::Renderer,
{
Expand Down
4 changes: 2 additions & 2 deletions widget/src/combo_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ enum TextInputEvent {
TextChanged(String),
}

impl<'a, T, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for ComboBox<'a, T, Message, Theme, Renderer>
impl<T, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for ComboBox<'_, T, Message, Theme, Renderer>
where
T: Display + Clone + 'static,
Message: Clone,
Expand Down
6 changes: 3 additions & 3 deletions widget/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ where
}
}

impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Container<'a, Message, Theme, Renderer>
impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Container<'_, Message, Theme, Renderer>
where
Theme: Catalog,
Renderer: core::Renderer,
Expand Down Expand Up @@ -650,7 +650,7 @@ pub trait Catalog {
/// A styling function for a [`Container`].
pub type StyleFn<'a, Theme> = Box<dyn Fn(&Theme) -> Style + 'a>;

impl<'a, Theme> From<Style> for StyleFn<'a, Theme> {
impl<Theme> From<Style> for StyleFn<'_, Theme> {
fn from(style: Style) -> Self {
Box::new(move |_theme| style)
}
Expand Down
8 changes: 4 additions & 4 deletions widget/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ where
content: Element<'a, Message, Theme, Renderer>,
}

impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Opaque<'a, Message, Theme, Renderer>
impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Opaque<'_, Message, Theme, Renderer>
where
Renderer: core::Renderer,
{
Expand Down Expand Up @@ -569,8 +569,8 @@ where
is_hovered: bool,
}

impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Hover<'a, Message, Theme, Renderer>
impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Hover<'_, Message, Theme, Renderer>
where
Renderer: core::Renderer,
{
Expand Down
6 changes: 3 additions & 3 deletions widget/src/keyed/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ where
}
}

impl<'a, Key, Message, Renderer> Default for Column<'a, Key, Message, Renderer>
impl<Key, Message, Renderer> Default for Column<'_, Key, Message, Renderer>
where
Key: Copy + PartialEq,
Renderer: crate::core::Renderer,
Expand All @@ -202,8 +202,8 @@ where
keys: Vec<Key>,
}

impl<'a, Key, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Column<'a, Key, Message, Theme, Renderer>
impl<Key, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Column<'_, Key, Message, Theme, Renderer>
where
Renderer: crate::core::Renderer,
Key: Copy + PartialEq + 'static,
Expand Down
10 changes: 5 additions & 5 deletions widget/src/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,16 @@ struct Overlay<'a, Message, Theme, Renderer>(
Option<Inner<'a, Message, Theme, Renderer>>,
);

impl<'a, Message, Theme, Renderer> Drop
for Overlay<'a, Message, Theme, Renderer>
impl<Message, Theme, Renderer> Drop
for Overlay<'_, Message, Theme, Renderer>
{
fn drop(&mut self) {
let heads = self.0.take().unwrap().into_heads();
(*heads.cell.borrow_mut()) = Some(heads.element);
}
}

impl<'a, Message, Theme, Renderer> Overlay<'a, Message, Theme, Renderer> {
impl<Message, Theme, Renderer> Overlay<'_, Message, Theme, Renderer> {
fn with_overlay_maybe<T>(
&self,
f: impl FnOnce(&mut Nested<'_, Message, Theme, Renderer>) -> T,
Expand All @@ -350,8 +350,8 @@ impl<'a, Message, Theme, Renderer> Overlay<'a, Message, Theme, Renderer> {
}
}

impl<'a, Message, Theme, Renderer> overlay::Overlay<Message, Theme, Renderer>
for Overlay<'a, Message, Theme, Renderer>
impl<Message, Theme, Renderer> overlay::Overlay<Message, Theme, Renderer>
for Overlay<'_, Message, Theme, Renderer>
where
Renderer: core::Renderer,
{
Expand Down
Loading

0 comments on commit 6026613

Please sign in to comment.