From a52456741aef74b5cfbe7efdd23a175389f9bc31 Mon Sep 17 00:00:00 2001 From: "Kai A. Hiller" Date: Tue, 24 Aug 2021 14:01:05 +0200 Subject: [PATCH] clippy_inception: 3. Fix code --- po/POTFILES.in | 5 ----- src/meson.build | 5 ----- src/session/content/explore/mod.rs | 16 ++++++++++------ src/session/content/mod.rs | 30 +++++++++++++++++++++++++----- src/session/room/mod.rs | 20 +++++++++++++++++--- src/session/sidebar/mod.rs | 27 +++++++++++++++++++++------ 6 files changed, 73 insertions(+), 30 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index d4a8fc10..1c55e8f1 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -45,18 +45,15 @@ src/error.rs src/login.rs src/main.rs src/secret.rs -src/session/categories/categories.rs src/session/categories/category.rs src/session/categories/category_type.rs src/session/categories/mod.rs -src/session/content/content.rs src/session/content/divider_row.rs src/session/content/item_row.rs src/session/content/invite.rs src/session/content/markdown_popover.rs src/session/content/message_row.rs src/session/content/mod.rs -src/session/content/room_details/room_details.rs src/session/content/room_details/mod.rs src/session/content/room_history.rs src/session/content/state_row.rs @@ -66,7 +63,6 @@ src/session/room/event.rs src/session/room/highlight_flags.rs src/session/room/item.rs src/session/room/mod.rs -src/session/room/room.rs src/session/room/timeline.rs src/session/sidebar/category_row.rs src/session/sidebar/entry.rs @@ -74,7 +70,6 @@ src/session/sidebar/mod.rs src/session/sidebar/room_row.rs src/session/sidebar/row.rs src/session/sidebar/selection.rs -src/session/sidebar/sidebar.rs src/session/user.rs src/utils.rs src/window.rs diff --git a/src/meson.build b/src/meson.build index 5ce9765a..c0d57ba0 100644 --- a/src/meson.build +++ b/src/meson.build @@ -40,9 +40,7 @@ sources = files( 'session/event_source_dialog.rs', 'session/user.rs', 'session/mod.rs', - 'session/content/content.rs', 'session/content/divider_row.rs', - 'session/content/explore/explore.rs', 'session/content/explore/mod.rs', 'session/content/explore/public_room.rs', 'session/content/explore/public_room_list.rs', @@ -54,7 +52,6 @@ sources = files( 'session/content/mod.rs', 'session/content/room_history.rs', 'session/content/room_details/mod.rs', - 'session/content/room_details/room_details.rs', 'session/content/state_row.rs', 'session/room/event.rs', 'session/room/highlight_flags.rs', @@ -62,7 +59,6 @@ sources = files( 'session/room/member.rs', 'session/room/mod.rs', 'session/room/power_levels.rs', - 'session/room/room.rs', 'session/room/room_type.rs', 'session/room_list.rs', 'session/room/timeline.rs', @@ -73,7 +69,6 @@ sources = files( 'session/sidebar/row.rs', 'session/sidebar/room_row.rs', 'session/sidebar/selection.rs', - 'session/sidebar/sidebar.rs', ) custom_target( diff --git a/src/session/content/explore/mod.rs b/src/session/content/explore/mod.rs index f7b8e19e..01d190bb 100644 --- a/src/session/content/explore/mod.rs +++ b/src/session/content/explore/mod.rs @@ -1,14 +1,18 @@ -use crate::{ - session::content::explore::{PublicRoom, PublicRoomList, PublicRoomRow}, - session::Session, -}; +mod public_room; +mod public_room_list; +mod public_room_row; -use matrix_sdk::ruma::api::client::r0::thirdparty::get_protocols; +pub use self::public_room::PublicRoom; +pub use self::public_room_list::PublicRoomList; +pub use self::public_room_row::PublicRoomRow; -use crate::utils::do_async; use adw::subclass::prelude::*; use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate}; use log::error; +use matrix_sdk::ruma::api::client::r0::thirdparty::get_protocols; + +use crate::session::Session; +use crate::utils::do_async; mod imp { use super::*; diff --git a/src/session/content/mod.rs b/src/session/content/mod.rs index 61c84443..c1a08974 100644 --- a/src/session/content/mod.rs +++ b/src/session/content/mod.rs @@ -1,11 +1,31 @@ -use crate::session::{ - content::{ContentType, Explore, Invite, RoomHistory}, - room::{Room, RoomType}, - Session, -}; +mod content_type; +mod divider_row; +mod explore; +mod invite; +mod item_row; +mod markdown_popover; +mod message_row; +mod room_details; +mod room_history; +mod state_row; + +pub use self::content_type::ContentType; +use self::divider_row::DividerRow; +use self::explore::Explore; +use self::invite::Invite; +use self::item_row::ItemRow; +use self::markdown_popover::MarkdownPopover; +use self::message_row::MessageRow; +use self::room_details::RoomDetails; +use self::room_history::RoomHistory; +use self::state_row::StateRow; + use adw::subclass::prelude::*; use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate}; +use crate::session::room::{Room, RoomType}; +use crate::session::Session; + mod imp { use super::*; use glib::{signal::SignalHandlerId, subclass::InitializingObject}; diff --git a/src/session/room/mod.rs b/src/session/room/mod.rs index 11c57b6d..7bf15cad 100644 --- a/src/session/room/mod.rs +++ b/src/session/room/mod.rs @@ -1,3 +1,20 @@ +mod event; +mod highlight_flags; +mod item; +mod member; +mod power_levels; +mod room_type; +mod timeline; + +pub use self::event::Event; +pub use self::highlight_flags::HighlightFlags; +pub use self::item::Item; +pub use self::item::ItemType; +pub use self::member::Member; +pub use self::power_levels::{PowerLevels, RoomAction}; +pub use self::room_type::RoomType; +pub use self::timeline::Timeline; + use gettextrs::gettext; use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*}; use log::{debug, error, info, warn}; @@ -37,9 +54,6 @@ use std::path::PathBuf; use crate::components::{LabelWithWidgets, Pill}; use crate::prelude::*; use crate::session::avatar::update_room_avatar_from_file; -use crate::session::room::{ - Event, HighlightFlags, Member, PowerLevels, RoomAction, RoomType, Timeline, -}; use crate::session::{Avatar, Session}; use crate::utils::do_async; use crate::Error; diff --git a/src/session/sidebar/mod.rs b/src/session/sidebar/mod.rs index 19fe5a82..56cbef1e 100644 --- a/src/session/sidebar/mod.rs +++ b/src/session/sidebar/mod.rs @@ -1,12 +1,27 @@ +mod category; +mod category_row; +mod entry; +mod entry_row; +mod item_list; +mod room_row; +mod row; +mod selection; + +pub use self::category::Category; +use self::category_row::CategoryRow; +pub use self::entry::Entry; +use self::entry_row::EntryRow; +pub use self::item_list::ItemList; +use self::room_row::RoomRow; +use self::row::Row; +use self::selection::Selection; + use adw::subclass::prelude::BinImpl; use gtk::{gio, glib, prelude::*, subclass::prelude::*, CompositeTemplate}; -use crate::session::{ - content::ContentType, - room::Room, - sidebar::{Category, Entry, ItemList, RoomRow, Row, Selection}, - RoomList, -}; +use crate::session::content::ContentType; +use crate::session::room::Room; +use crate::session::RoomList; mod imp { use super::*;