use 'Self' keyword to refer to own type (clippy::use_self)

This commit is contained in:
Daniel Eades 2023-12-10 16:32:17 +00:00
parent 12a5804fa7
commit 1ffd464c21
7 changed files with 24 additions and 24 deletions

View file

@ -135,9 +135,9 @@ impl Page {
}
impl Default for Page {
fn default() -> Page {
fn default() -> Self {
//TODO: what should the default page be?
Page::Desktop(None)
Self::Desktop(None)
}
}
@ -214,8 +214,8 @@ pub enum Message {
}
impl From<Page> for Message {
fn from(page: Page) -> Message {
Message::Page(page)
fn from(page: Page) -> Self {
Self::Page(page)
}
}
@ -323,7 +323,7 @@ impl Application for Window {
type Theme = Theme;
fn new(_flags: ()) -> (Self, Command<Self::Message>) {
let mut window = Window::default()
let mut window = Self::default()
.nav_bar_toggled(true)
.show_maximize(true)
.show_minimize(true);

View file

@ -35,19 +35,19 @@ pub enum ThemeVariant {
impl From<&ThemeType> for ThemeVariant {
fn from(theme: &ThemeType) -> Self {
match theme {
ThemeType::Light => ThemeVariant::Light,
ThemeType::Dark => ThemeVariant::Dark,
ThemeType::HighContrastDark => ThemeVariant::HighContrastDark,
ThemeType::HighContrastLight => ThemeVariant::HighContrastLight,
ThemeType::Custom(_) => ThemeVariant::Custom,
ThemeType::System(_) => ThemeVariant::System,
ThemeType::Light => Self::Light,
ThemeType::Dark => Self::Dark,
ThemeType::HighContrastDark => Self::HighContrastDark,
ThemeType::HighContrastLight => Self::HighContrastLight,
ThemeType::Custom(_) => Self::Custom,
ThemeType::System(_) => Self::System,
}
}
}
impl From<ThemeType> for ThemeVariant {
fn from(theme: ThemeType) -> Self {
ThemeVariant::from(&theme)
Self::from(&theme)
}
}
@ -118,8 +118,8 @@ pub struct State {
}
impl Default for State {
fn default() -> State {
State {
fn default() -> Self {
Self {
checkbox_value: false,
dropdown_selected: Some(0),
dropdown_options: vec!["Option 1", "Option 2", "Option 3", "Option 4"],

View file

@ -42,8 +42,8 @@ pub enum Message {
}
impl From<Page> for Message {
fn from(page: Page) -> Message {
Message::Page(page)
fn from(page: Page) -> Self {
Self::Page(page)
}
}