Fix clippy lints for Rust 1.68

This commit is contained in:
Héctor Ramón Jiménez 2023-03-14 11:11:17 +01:00
parent 8f14b448d2
commit 1816c985fa
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
7 changed files with 18 additions and 54 deletions

View file

@ -1,10 +1,11 @@
/// A font. /// A font.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy, Default)]
pub enum Font { pub enum Font {
/// The default font. /// The default font.
/// ///
/// This is normally a font configured in a renderer or loaded from the /// This is normally a font configured in a renderer or loaded from the
/// system. /// system.
#[default]
Default, Default,
/// An external font. /// An external font.
@ -16,9 +17,3 @@ pub enum Font {
bytes: &'static [u8], bytes: &'static [u8],
}, },
} }
impl Default for Font {
fn default() -> Font {
Font::Default
}
}

View file

@ -1,7 +1,8 @@
/// The interaction of a mouse cursor. /// The interaction of a mouse cursor.
#[derive(Debug, Eq, PartialEq, Clone, Copy, PartialOrd, Ord)] #[derive(Debug, Eq, PartialEq, Clone, Copy, PartialOrd, Ord, Default)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum Interaction { pub enum Interaction {
#[default]
Idle, Idle,
Pointer, Pointer,
Grab, Grab,
@ -12,9 +13,3 @@ pub enum Interaction {
ResizingHorizontally, ResizingHorizontally,
ResizingVertically, ResizingVertically,
} }
impl Default for Interaction {
fn default() -> Interaction {
Interaction::Idle
}
}

View file

@ -61,8 +61,9 @@ impl Sandbox for Example {
} }
} }
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Language { pub enum Language {
#[default]
Rust, Rust,
Elm, Elm,
Ruby, Ruby,
@ -84,12 +85,6 @@ impl Language {
]; ];
} }
impl Default for Language {
fn default() -> Language {
Language::Rust
}
}
impl std::fmt::Display for Language { impl std::fmt::Display for Language {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!( write!(

View file

@ -435,19 +435,16 @@ fn view_controls(tasks: &[Task], current_filter: Filter) -> Element<Message> {
.into() .into()
} }
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[derive(
Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize,
)]
pub enum Filter { pub enum Filter {
#[default]
All, All,
Active, Active,
Completed, Completed,
} }
impl Default for Filter {
fn default() -> Self {
Filter::All
}
}
impl Filter { impl Filter {
fn matches(&self, task: &Task) -> bool { fn matches(&self, task: &Task) -> bool {
match self { match self {

View file

@ -9,9 +9,10 @@ use crate::triangle;
use std::sync::Arc; use std::sync::Arc;
/// A rendering primitive. /// A rendering primitive.
#[derive(Debug, Clone)] #[derive(Debug, Clone, Default)]
pub enum Primitive { pub enum Primitive {
/// An empty primitive /// An empty primitive
#[default]
None, None,
/// A group of primitives /// A group of primitives
Group { Group {
@ -117,9 +118,3 @@ pub enum Primitive {
cache: Arc<Primitive>, cache: Arc<Primitive>,
}, },
} }
impl Default for Primitive {
fn default() -> Primitive {
Primitive::None
}
}

View file

@ -4,7 +4,9 @@ use crate::Primitive;
use iced_native::Size; use iced_native::Size;
use std::{cell::RefCell, sync::Arc}; use std::{cell::RefCell, sync::Arc};
#[derive(Default)]
enum State { enum State {
#[default]
Empty, Empty,
Filled { Filled {
bounds: Size, bounds: Size,
@ -12,11 +14,6 @@ enum State {
}, },
} }
impl Default for State {
fn default() -> Self {
State::Empty
}
}
/// A simple cache that stores generated [`Geometry`] to avoid recomputation. /// A simple cache that stores generated [`Geometry`] to avoid recomputation.
/// ///
/// A [`Cache`] will not redraw its geometry unless the dimensions of its layer /// A [`Cache`] will not redraw its geometry unless the dimensions of its layer

View file

@ -59,9 +59,10 @@ impl<'a> Default for Stroke<'a> {
} }
/// The shape used at the end of open subpaths when they are stroked. /// The shape used at the end of open subpaths when they are stroked.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy, Default)]
pub enum LineCap { pub enum LineCap {
/// The stroke for each sub-path does not extend beyond its two endpoints. /// The stroke for each sub-path does not extend beyond its two endpoints.
#[default]
Butt, Butt,
/// At the end of each sub-path, the shape representing the stroke will be /// At the end of each sub-path, the shape representing the stroke will be
/// extended by a square. /// extended by a square.
@ -71,12 +72,6 @@ pub enum LineCap {
Round, Round,
} }
impl Default for LineCap {
fn default() -> LineCap {
LineCap::Butt
}
}
impl From<LineCap> for lyon::tessellation::LineCap { impl From<LineCap> for lyon::tessellation::LineCap {
fn from(line_cap: LineCap) -> lyon::tessellation::LineCap { fn from(line_cap: LineCap) -> lyon::tessellation::LineCap {
match line_cap { match line_cap {
@ -89,9 +84,10 @@ impl From<LineCap> for lyon::tessellation::LineCap {
/// The shape used at the corners of paths or basic shapes when they are /// The shape used at the corners of paths or basic shapes when they are
/// stroked. /// stroked.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy, Default)]
pub enum LineJoin { pub enum LineJoin {
/// A sharp corner. /// A sharp corner.
#[default]
Miter, Miter,
/// A round corner. /// A round corner.
Round, Round,
@ -99,12 +95,6 @@ pub enum LineJoin {
Bevel, Bevel,
} }
impl Default for LineJoin {
fn default() -> LineJoin {
LineJoin::Miter
}
}
impl From<LineJoin> for lyon::tessellation::LineJoin { impl From<LineJoin> for lyon::tessellation::LineJoin {
fn from(line_join: LineJoin) -> lyon::tessellation::LineJoin { fn from(line_join: LineJoin) -> lyon::tessellation::LineJoin {
match line_join { match line_join {