use 'Self' to refer to own type

This commit is contained in:
daniel.eades 2023-11-16 18:32:31 +00:00 committed by Ashley Wulber
parent a88cbad37f
commit b9723dd5e0
15 changed files with 48 additions and 54 deletions

View file

@ -108,7 +108,7 @@ impl DockItem {
rectangle_tracker: Option<&RectangleTracker<u32>>,
interaction_enabled: bool,
) -> Element<'_, Message> {
let DockItem {
let Self {
toplevels,
desktop_info,
id,
@ -377,7 +377,7 @@ impl cosmic::Application for CosmicAppList {
_flags: Self::Flags,
) -> (Self, iced::Command<cosmic::app::Message<Self::Message>>) {
let config = config::AppListConfig::load().unwrap_or_default();
let mut self_ = CosmicAppList {
let mut self_ = Self {
core,
favorite_list: desktop_info_for_app_ids(config.favorites.clone())
.into_iter()

View file

@ -26,7 +26,7 @@ pub struct AppListConfig {
impl AppListConfig {
// TODO async?
/// load config with the provided name
pub fn load() -> anyhow::Result<AppListConfig> {
pub fn load() -> anyhow::Result<Self> {
let mut relative_path = PathBuf::from(APP_ID);
relative_path.push("config.ron");
let file = match BaseDirectories::new()
@ -40,7 +40,7 @@ impl AppListConfig {
}
};
ron::de::from_reader::<_, AppListConfig>(file)
ron::de::from_reader::<_, Self>(file)
.map_err(|err| anyhow!("Failed to parse config file: {}", err))
}