Fix clippy::default_trait_access

This commit is contained in:
Héctor Ramón Jiménez 2023-09-20 04:51:08 +02:00
parent 6c386e90a1
commit 42ed90bc6f
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
19 changed files with 30 additions and 28 deletions

View file

@ -1,2 +1,2 @@
[alias] [alias]
lint = "clippy --workspace --no-deps -- -D warnings -D clippy::semicolon_if_nothing_returned -D clippy::trivially-copy-pass-by-ref" lint = "clippy --workspace --no-deps -- -D warnings -D clippy::semicolon_if_nothing_returned -D clippy::trivially-copy-pass-by-ref -D clippy::default_trait_access"

View file

@ -37,7 +37,7 @@ impl Application for Arc {
( (
Arc { Arc {
start: Instant::now(), start: Instant::now(),
cache: Default::default(), cache: Cache::default(),
}, },
Command::none(), Command::none(),
) )

View file

@ -35,7 +35,7 @@ impl Application for Clock {
Clock { Clock {
now: time::OffsetDateTime::now_local() now: time::OffsetDateTime::now_local()
.unwrap_or_else(|_| time::OffsetDateTime::now_utc()), .unwrap_or_else(|_| time::OffsetDateTime::now_utc()),
clock: Default::default(), clock: Cache::default(),
}, },
Command::none(), Command::none(),
) )

View file

@ -19,7 +19,7 @@ impl Controls {
pub fn new() -> Controls { pub fn new() -> Controls {
Controls { Controls {
background_color: Color::BLACK, background_color: Color::BLACK,
text: Default::default(), text: String::default(),
} }
} }

View file

@ -27,7 +27,7 @@ impl Default for App {
.into_iter() .into_iter()
.map(From::from) .map(From::from)
.collect(), .collect(),
input: Default::default(), input: String::default(),
order: Order::Ascending, order: Order::Ascending,
} }
} }
@ -107,7 +107,7 @@ impl From<&str> for Item {
fn from(s: &str) -> Self { fn from(s: &str) -> Self {
Self { Self {
name: s.to_owned(), name: s.to_owned(),
color: Default::default(), color: Color::default(),
} }
} }
} }

View file

@ -228,7 +228,9 @@ mod modal {
use iced::alignment::Alignment; use iced::alignment::Alignment;
use iced::event; use iced::event;
use iced::mouse; use iced::mouse;
use iced::{Color, Element, Event, Length, Point, Rectangle, Size}; use iced::{
BorderRadius, Color, Element, Event, Length, Point, Rectangle, Size,
};
/// A widget that centers a modal element over some base element /// A widget that centers a modal element over some base element
pub struct Modal<'a, Message, Renderer> { pub struct Modal<'a, Message, Renderer> {
@ -474,7 +476,7 @@ mod modal {
renderer.fill_quad( renderer.fill_quad(
renderer::Quad { renderer::Quad {
bounds: layout.bounds(), bounds: layout.bounds(),
border_radius: Default::default(), border_radius: BorderRadius::default(),
border_width: 0.0, border_width: 0.0,
border_color: Color::TRANSPARENT, border_color: Color::TRANSPARENT,
}, },

View file

@ -391,12 +391,12 @@ impl scrollable::StyleSheet for ScrollbarCustomStyle {
.background, .background,
border_radius: 2.0.into(), border_radius: 2.0.into(),
border_width: 0.0, border_width: 0.0,
border_color: Default::default(), border_color: Color::default(),
scroller: Scroller { scroller: Scroller {
color: Color::from_rgb8(250, 85, 134), color: Color::from_rgb8(250, 85, 134),
border_radius: 2.0.into(), border_radius: 2.0.into(),
border_width: 0.0, border_width: 0.0,
border_color: Default::default(), border_color: Color::default(),
}, },
} }
} else { } else {

View file

@ -117,8 +117,8 @@ impl State {
let (width, height) = window::Settings::default().size; let (width, height) = window::Settings::default().size;
State { State {
space_cache: Default::default(), space_cache: canvas::Cache::default(),
system_cache: Default::default(), system_cache: canvas::Cache::default(),
start: now, start: now,
now, now,
stars: Self::generate_stars(width, height), stars: Self::generate_stars(width, height),

View file

@ -35,7 +35,7 @@ impl Cache {
/// Creates a new empty [`Cache`]. /// Creates a new empty [`Cache`].
pub fn new() -> Self { pub fn new() -> Self {
Cache { Cache {
state: Default::default(), state: RefCell::default(),
} }
} }

View file

@ -77,9 +77,9 @@ where
fn default() -> Self { fn default() -> Self {
Self { Self {
id: None, id: None,
window: Default::default(), window: window::Settings::default(),
flags: Default::default(), flags: Default::default(),
default_font: Default::default(), default_font: Font::default(),
default_text_size: Pixels(16.0), default_text_size: Pixels(16.0),
antialiasing: false, antialiasing: false,
exit_on_close_request: true, exit_on_close_request: true,

View file

@ -52,7 +52,7 @@ impl Default for Settings {
transparent: false, transparent: false,
level: Level::default(), level: Level::default(),
icon: None, icon: None,
platform_specific: Default::default(), platform_specific: PlatformSpecific::default(),
} }
} }
} }

View file

@ -393,7 +393,7 @@ impl container::StyleSheet for Theme {
fn appearance(&self, style: &Self::Style) -> container::Appearance { fn appearance(&self, style: &Self::Style) -> container::Appearance {
match style { match style {
Container::Transparent => Default::default(), Container::Transparent => container::Appearance::default(),
Container::Box => { Container::Box => {
let palette = self.extended_palette(); let palette = self.extended_palette();
@ -904,7 +904,7 @@ impl svg::StyleSheet for Theme {
fn appearance(&self, style: &Self::Style) -> svg::Appearance { fn appearance(&self, style: &Self::Style) -> svg::Appearance {
match style { match style {
Svg::Default => Default::default(), Svg::Default => svg::Appearance::default(),
Svg::Custom(custom) => custom.appearance(self), Svg::Custom(custom) => custom.appearance(self),
} }
} }
@ -1053,7 +1053,7 @@ impl text::StyleSheet for Theme {
fn appearance(&self, style: Self::Style) -> text::Appearance { fn appearance(&self, style: Self::Style) -> text::Appearance {
match style { match style {
Text::Default => Default::default(), Text::Default => text::Appearance::default(),
Text::Color(c) => text::Appearance { color: Some(c) }, Text::Color(c) => text::Appearance { color: Some(c) },
} }
} }

View file

@ -180,7 +180,7 @@ fn convert_path(path: &Path) -> Option<tiny_skia::Path> {
use iced_graphics::geometry::path::lyon_path; use iced_graphics::geometry::path::lyon_path;
let mut builder = tiny_skia::PathBuilder::new(); let mut builder = tiny_skia::PathBuilder::new();
let mut last_point = Default::default(); let mut last_point = lyon_path::math::Point::default();
for event in path.raw() { for event in path.raw() {
match event { match event {

View file

@ -12,7 +12,7 @@ pub fn convert(
let sampler = device.create_sampler(&wgpu::SamplerDescriptor { let sampler = device.create_sampler(&wgpu::SamplerDescriptor {
label: Some("iced_wgpu.offscreen.sampler"), label: Some("iced_wgpu.offscreen.sampler"),
..Default::default() ..wgpu::SamplerDescriptor::default()
}); });
//sampler in 0 //sampler in 0
@ -102,10 +102,10 @@ pub fn convert(
primitive: wgpu::PrimitiveState { primitive: wgpu::PrimitiveState {
topology: wgpu::PrimitiveTopology::TriangleList, topology: wgpu::PrimitiveTopology::TriangleList,
front_face: wgpu::FrontFace::Cw, front_face: wgpu::FrontFace::Cw,
..Default::default() ..wgpu::PrimitiveState::default()
}, },
depth_stencil: None, depth_stencil: None,
multisample: Default::default(), multisample: wgpu::MultisampleState::default(),
multiview: None, multiview: None,
}); });

View file

@ -64,7 +64,7 @@ impl Pipeline {
self.renderers.push(glyphon::TextRenderer::new( self.renderers.push(glyphon::TextRenderer::new(
&mut self.atlas, &mut self.atlas,
device, device,
Default::default(), wgpu::MultisampleState::default(),
None, None,
)); ));
} }

View file

@ -76,7 +76,7 @@ where
text_line_height: text::LineHeight::default(), text_line_height: text::LineHeight::default(),
text_shaping: text::Shaping::Basic, text_shaping: text::Shaping::Basic,
font: None, font: None,
handle: Default::default(), handle: Handle::default(),
style: Default::default(), style: Default::default(),
} }
} }

View file

@ -46,7 +46,7 @@ where
id: None, id: None,
width: Length::Shrink, width: Length::Shrink,
height: Length::Shrink, height: Length::Shrink,
direction: Default::default(), direction: Direction::default(),
content: content.into(), content: content.into(),
on_scroll: None, on_scroll: None,
style: Default::default(), style: Default::default(),

View file

@ -286,7 +286,7 @@ where
style, style,
label_layout, label_layout,
tree.state.downcast_ref(), tree.state.downcast_ref(),
Default::default(), crate::text::Appearance::default(),
); );
} }

View file

@ -235,7 +235,7 @@ impl Default for Window {
transparent: false, transparent: false,
level: Level::default(), level: Level::default(),
icon: None, icon: None,
platform_specific: Default::default(), platform_specific: PlatformSpecific::default(),
} }
} }
} }