use 'Self' keyword to refer to own type (clippy::use_self)
This commit is contained in:
parent
12a5804fa7
commit
1ffd464c21
7 changed files with 24 additions and 24 deletions
|
|
@ -19,10 +19,10 @@ pub enum Page {
|
|||
impl Page {
|
||||
const fn as_str(self) -> &'static str {
|
||||
match self {
|
||||
Page::Page1 => "Page 1",
|
||||
Page::Page2 => "Page 2",
|
||||
Page::Page3 => "Page 3",
|
||||
Page::Page4 => "Page 4",
|
||||
Self::Page1 => "Page 1",
|
||||
Self::Page2 => "Page 2",
|
||||
Self::Page3 => "Page 3",
|
||||
Self::Page4 => "Page 4",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@ impl cosmic::Application for App {
|
|||
|
||||
nav_model.activate_position(0);
|
||||
|
||||
let mut app = App { core, nav_model };
|
||||
let mut app = Self { core, nav_model };
|
||||
|
||||
let command = app.update_title();
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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"],
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ impl cosmic::Application for MultiWindow {
|
|||
}
|
||||
|
||||
fn init(core: Core, _input: Self::Flags) -> (Self, cosmic::app::Command<Self::Message>) {
|
||||
let windows = MultiWindow {
|
||||
let windows = Self {
|
||||
windows: HashMap::from([(
|
||||
window::Id::MAIN,
|
||||
Window {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ impl cosmic::Application for App {
|
|||
|
||||
/// Creates the application, and optionally emits command on initialize.
|
||||
fn init(core: Core, _input: Self::Flags) -> (Self, Command<Self::Message>) {
|
||||
let mut app = App {
|
||||
let mut app = Self {
|
||||
core,
|
||||
open_sender: None,
|
||||
file_contents: String::new(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue