[fractal/fractal-next] app: Apply new formatting rules



commit fe2ff7c79ab80607631c267f5e4910c18306cf36
Author: Kévin Commaille <zecakeh tedomum fr>
Date:   Thu Jan 20 09:24:22 2022 +0100

    app: Apply new formatting rules

 src/application.rs                                 | 14 ++--
 src/components/auth_dialog.rs                      | 57 +++++++--------
 src/components/avatar.rs                           |  6 +-
 src/components/badge.rs                            |  9 ++-
 src/components/context_menu_bin.rs                 |  7 +-
 src/components/custom_entry.rs                     |  3 +-
 src/components/in_app_notification.rs              | 13 ++--
 src/components/label_with_widgets.rs               |  9 ++-
 src/components/loading_listbox_row.rs              |  6 +-
 src/components/mod.rs                              | 28 ++++----
 src/components/pill.rs                             | 18 ++---
 src/components/reaction_chooser.rs                 |  6 +-
 src/components/room_title.rs                       | 16 +++--
 src/components/spinner_button.rs                   |  7 +-
 src/components/video_player.rs                     |  6 +-
 src/contrib/mod.rs                                 |  6 +-
 src/contrib/qr_code.rs                             | 12 ++--
 src/contrib/qr_code_scanner/camera_paintable.rs    | 28 ++++----
 src/contrib/qr_code_scanner/mod.rs                 | 16 ++---
 src/contrib/qr_code_scanner/qr_code_detector.rs    |  6 +-
 src/contrib/qr_code_scanner/screenshot.rs          |  3 +-
 src/error.rs                                       |  6 +-
 src/login.rs                                       | 20 +++---
 src/main.rs                                        | 16 ++---
 src/secret.rs                                      | 11 ++-
 .../account_settings/devices_page/device.rs        |  9 ++-
 .../account_settings/devices_page/device_item.rs   |  3 +-
 .../account_settings/devices_page/device_list.rs   | 13 ++--
 .../account_settings/devices_page/device_row.rs    | 11 +--
 src/session/account_settings/devices_page/mod.rs   | 13 ++--
 src/session/account_settings/mod.rs                |  6 +-
 src/session/avatar.rs                              | 23 +++---
 src/session/content/explore/mod.rs                 | 19 +++--
 src/session/content/explore/public_room.rs         |  6 +-
 src/session/content/explore/public_room_list.rs    | 20 +++---
 src/session/content/explore/public_room_row.rs     | 16 +++--
 src/session/content/invite.rs                      | 15 ++--
 src/session/content/markdown_popover.rs            |  6 +-
 src/session/content/mod.rs                         | 32 ++++-----
 .../content/room_details/invite_subpage/invitee.rs | 13 ++--
 .../room_details/invite_subpage/invitee_list.rs    | 23 +++---
 .../room_details/invite_subpage/invitee_row.rs     |  8 ++-
 .../content/room_details/invite_subpage/mod.rs     | 23 +++---
 .../room_details/member_page/member_menu.rs        | 10 +--
 .../content/room_details/member_page/member_row.rs | 11 +--
 .../content/room_details/member_page/mod.rs        | 38 +++++-----
 src/session/content/room_details/mod.rs            | 20 +++---
 src/session/content/room_history/divider_row.rs    |  3 +-
 src/session/content/room_history/item_row.rs       | 21 ++++--
 .../content/room_history/message_row/file.rs       |  6 +-
 .../content/room_history/message_row/mod.rs        | 19 +++--
 .../content/room_history/message_row/reaction.rs   |  3 +-
 .../room_history/message_row/reaction_list.rs      |  6 +-
 .../content/room_history/message_row/reply.rs      |  3 +-
 .../content/room_history/message_row/text.rs       | 10 +--
 src/session/content/room_history/mod.rs            | 40 +++++++----
 .../content/room_history/state_row/creation.rs     |  4 +-
 src/session/content/room_history/state_row/mod.rs  | 10 +--
 .../content/room_history/state_row/tombstone.rs    |  3 +-
 .../content/room_history/verification_info_bar.rs  | 18 +++--
 src/session/content/verification/emoji.rs          |  4 +-
 .../verification/identity_verification_widget.rs   | 28 ++++----
 src/session/content/verification/mod.rs            |  7 +-
 .../content/verification/session_verification.rs   | 21 +++---
 src/session/event_source_dialog.rs                 |  6 +-
 src/session/media_viewer.rs                        | 12 ++--
 src/session/mod.rs                                 | 84 +++++++++++-----------
 src/session/room/event.rs                          | 54 ++++++++------
 src/session/room/event_actions.rs                  |  6 +-
 src/session/room/item.rs                           |  6 +-
 src/session/room/member.rs                         | 37 ++++++----
 src/session/room/member_list.rs                    | 24 ++++---
 src/session/room/mod.rs                            | 70 +++++++++---------
 src/session/room/power_levels.rs                   | 18 ++---
 src/session/room/reaction_group.rs                 |  9 +--
 src/session/room/reaction_list.rs                  | 10 +--
 src/session/room/timeline.rs                       | 44 +++++++-----
 src/session/room_creation/mod.rs                   | 24 ++++---
 src/session/room_list.rs                           | 20 +++---
 .../sidebar/account_switcher/add_account.rs        |  7 +-
 .../account_switcher/avatar_with_selection.rs      |  6 +-
 src/session/sidebar/account_switcher/item.rs       | 15 ++--
 src/session/sidebar/account_switcher/mod.rs        |  6 +-
 src/session/sidebar/account_switcher/user_entry.rs |  8 ++-
 src/session/sidebar/category.rs                    |  6 +-
 src/session/sidebar/category_row.rs                | 10 +--
 src/session/sidebar/category_type.rs               |  3 +-
 src/session/sidebar/entry_row.rs                   | 10 +--
 src/session/sidebar/item_list.rs                   |  8 +--
 src/session/sidebar/mod.rs                         | 43 +++++------
 src/session/sidebar/room_row.rs                    |  6 +-
 src/session/sidebar/row.rs                         |  9 +--
 src/session/sidebar/selection.rs                   |  6 +-
 src/session/sidebar/verification_row.rs            |  6 +-
 src/session/user.rs                                | 28 +++++---
 src/session/verification/identity_verification.rs  | 28 ++++----
 src/session/verification/mod.rs                    | 12 ++--
 src/session/verification/verification_list.rs      | 19 ++---
 src/user_facing_error.rs                           |  6 +-
 src/utils.rs                                       | 22 +++---
 src/window.rs                                      | 23 +++---
 101 files changed, 874 insertions(+), 710 deletions(-)
---
diff --git a/src/application.rs b/src/application.rs
index bb4e4b86..b5ae4a65 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -1,20 +1,18 @@
-use crate::config;
-use crate::Window;
 use gettextrs::gettext;
 use gio::{ApplicationFlags, Settings};
-use glib::clone;
-use glib::WeakRef;
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
-use gtk::{gio, glib};
+use glib::{clone, WeakRef};
+use gtk::{gio, glib, prelude::*, subclass::prelude::*};
 use gtk_macros::action;
 use log::{debug, info};
 
+use crate::{config, Window};
+
 mod imp {
-    use super::*;
     use adw::subclass::prelude::AdwApplicationImpl;
     use once_cell::unsync::OnceCell;
 
+    use super::*;
+
     #[derive(Debug)]
     pub struct Application {
         pub window: OnceCell<WeakRef<Window>>,
diff --git a/src/components/auth_dialog.rs b/src/components/auth_dialog.rs
index 62395123..abb748b7 100644
--- a/src/components/auth_dialog.rs
+++ b/src/components/auth_dialog.rs
@@ -1,35 +1,32 @@
-use adw::subclass::prelude::*;
-use gtk::gdk;
-use gtk::gio::prelude::*;
-use gtk::glib::clone;
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
-use gtk::{glib, CompositeTemplate};
-use std::cell::Cell;
-use std::future::Future;
-
-use crate::session::Session;
-use crate::session::UserExt;
-use crate::spawn_tokio;
+use std::{cell::Cell, fmt::Debug, future::Future};
 
+use adw::subclass::prelude::*;
+use gtk::{
+    gdk, gio::prelude::*, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate,
+};
 use matrix_sdk::{
-    ruma::api::{
-        client::{
-            error::ErrorBody,
-            r0::uiaa::{
-                AuthData as MatrixAuthData,
-                FallbackAcknowledgement as MatrixFallbackAcknowledgement,
-                Password as MatrixPassword, UiaaInfo, UiaaResponse, UserIdentifier,
+    ruma::{
+        api::{
+            client::{
+                error::ErrorBody,
+                r0::uiaa::{
+                    AuthData as MatrixAuthData,
+                    FallbackAcknowledgement as MatrixFallbackAcknowledgement,
+                    Password as MatrixPassword, UiaaInfo, UiaaResponse, UserIdentifier,
+                },
             },
+            error::{FromHttpResponseError, ServerError},
         },
-        error::{FromHttpResponseError, ServerError},
+        assign,
     },
-    ruma::assign,
     Error,
     HttpError::UiaaError,
 };
 
-use std::fmt::Debug;
+use crate::{
+    session::{Session, UserExt},
+    spawn_tokio,
+};
 
 pub struct Password {
     pub user_id: String,
@@ -68,13 +65,17 @@ impl AuthData {
 }
 
 mod imp {
-    use super::*;
-    use glib::object::WeakRef;
-    use glib::subclass::{InitializingObject, Signal};
-    use glib::SignalHandlerId;
-    use once_cell::{sync::Lazy, unsync::OnceCell};
     use std::cell::RefCell;
 
+    use glib::{
+        object::WeakRef,
+        subclass::{InitializingObject, Signal},
+        SignalHandlerId,
+    };
+    use once_cell::{sync::Lazy, unsync::OnceCell};
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/components-auth-dialog.ui")]
     pub struct AuthDialog {
diff --git a/src/components/avatar.rs b/src/components/avatar.rs
index d685a3d9..e2eaa8e6 100644
--- a/src/components/avatar.rs
+++ b/src/components/avatar.rs
@@ -4,10 +4,12 @@ use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 use crate::session::Avatar as AvatarItem;
 
 mod imp {
-    use super::*;
+    use std::cell::RefCell;
+
     use glib::subclass::InitializingObject;
     use once_cell::sync::Lazy;
-    use std::cell::RefCell;
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/components-avatar.ui")]
diff --git a/src/components/badge.rs b/src/components/badge.rs
index d8500770..a6f50a0c 100644
--- a/src/components/badge.rs
+++ b/src/components/badge.rs
@@ -1,14 +1,13 @@
-use adw::prelude::*;
-use adw::subclass::prelude::*;
-use gtk::glib;
-use gtk::subclass::prelude::*;
+use adw::{prelude::*, subclass::prelude::*};
+use gtk::{glib, subclass::prelude::*};
 
 use crate::session::room::{MemberRole, PowerLevel, POWER_LEVEL_MAX, POWER_LEVEL_MIN};
 
 mod imp {
-    use super::*;
     use std::cell::Cell;
 
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct Badge {
         pub power_level: Cell<PowerLevel>,
diff --git a/src/components/context_menu_bin.rs b/src/components/context_menu_bin.rs
index bc39407a..c6f0d43e 100644
--- a/src/components/context_menu_bin.rs
+++ b/src/components/context_menu_bin.rs
@@ -1,13 +1,12 @@
 use adw::subclass::prelude::*;
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
-use gtk::{gdk, gio, glib, glib::clone, CompositeTemplate};
+use gtk::{gdk, gio, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 use log::debug;
 
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
 
+    use super::*;
+
     #[derive(Debug, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/context-menu-bin.ui")]
     pub struct ContextMenuBin {
diff --git a/src/components/custom_entry.rs b/src/components/custom_entry.rs
index 759316a5..ac60aafa 100644
--- a/src/components/custom_entry.rs
+++ b/src/components/custom_entry.rs
@@ -1,6 +1,5 @@
 use adw::subclass::prelude::*;
-use gtk::glib;
-use gtk::subclass::prelude::*;
+use gtk::{glib, subclass::prelude::*};
 
 mod imp {
     use super::*;
diff --git a/src/components/in_app_notification.rs b/src/components/in_app_notification.rs
index d0bd9a66..192b8009 100644
--- a/src/components/in_app_notification.rs
+++ b/src/components/in_app_notification.rs
@@ -1,14 +1,15 @@
-use crate::Error;
 use adw::subclass::prelude::*;
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
-use gtk::{gio, glib, glib::clone, CompositeTemplate};
+use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
+
+use crate::Error;
 
 mod imp {
-    use super::*;
-    use glib::{signal::SignalHandlerId, subclass::InitializingObject};
     use std::cell::{Cell, RefCell};
 
+    use glib::{signal::SignalHandlerId, subclass::InitializingObject};
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/in-app-notification.ui")]
     pub struct InAppNotification {
diff --git a/src/components/label_with_widgets.rs b/src/components/label_with_widgets.rs
index 7a18071c..afff1373 100644
--- a/src/components/label_with_widgets.rs
+++ b/src/components/label_with_widgets.rs
@@ -1,9 +1,7 @@
-use gtk::pango;
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
-use gtk::{glib, glib::clone};
 use std::cmp::max;
 
+use gtk::{glib, glib::clone, pango, prelude::*, subclass::prelude::*};
+
 const DEFAULT_PLACEHOLDER: &str = "<widget>";
 const PANGO_SCALE: i32 = 1024;
 const OBJECT_REPLACEMENT_CHARACTER: &str = "\u{FFFC}";
@@ -12,9 +10,10 @@ fn pango_pixels(d: i32) -> i32 {
 }
 
 mod imp {
-    use super::*;
     use std::cell::RefCell;
 
+    use super::*;
+
     #[derive(Debug)]
     pub struct LabelWithWidgets {
         pub widgets: RefCell<Vec<gtk::Widget>>,
diff --git a/src/components/loading_listbox_row.rs b/src/components/loading_listbox_row.rs
index 281dfdc1..053ca1a8 100644
--- a/src/components/loading_listbox_row.rs
+++ b/src/components/loading_listbox_row.rs
@@ -2,10 +2,12 @@ use glib::subclass::Signal;
 use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 mod imp {
-    use super::*;
+    use std::cell::Cell;
+
     use glib::subclass::InitializingObject;
     use once_cell::sync::Lazy;
-    use std::cell::Cell;
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/components-loading-listbox-row.ui")]
diff --git a/src/components/mod.rs b/src/components/mod.rs
index 81319af7..098e7bd1 100644
--- a/src/components/mod.rs
+++ b/src/components/mod.rs
@@ -12,16 +12,18 @@ mod room_title;
 mod spinner_button;
 mod video_player;
 
-pub use self::auth_dialog::{AuthData, AuthDialog};
-pub use self::avatar::Avatar;
-pub use self::badge::Badge;
-pub use self::context_menu_bin::{ContextMenuBin, ContextMenuBinExt, ContextMenuBinImpl};
-pub use self::custom_entry::CustomEntry;
-pub use self::in_app_notification::InAppNotification;
-pub use self::label_with_widgets::LabelWithWidgets;
-pub use self::loading_listbox_row::LoadingListBoxRow;
-pub use self::pill::Pill;
-pub use self::reaction_chooser::ReactionChooser;
-pub use self::room_title::RoomTitle;
-pub use self::spinner_button::SpinnerButton;
-pub use self::video_player::VideoPlayer;
+pub use self::{
+    auth_dialog::{AuthData, AuthDialog},
+    avatar::Avatar,
+    badge::Badge,
+    context_menu_bin::{ContextMenuBin, ContextMenuBinExt, ContextMenuBinImpl},
+    custom_entry::CustomEntry,
+    in_app_notification::InAppNotification,
+    label_with_widgets::LabelWithWidgets,
+    loading_listbox_row::LoadingListBoxRow,
+    pill::Pill,
+    reaction_chooser::ReactionChooser,
+    room_title::RoomTitle,
+    spinner_button::SpinnerButton,
+    video_player::VideoPlayer,
+};
diff --git a/src/components/pill.rs b/src/components/pill.rs
index 694c6d8b..52f50d79 100644
--- a/src/components/pill.rs
+++ b/src/components/pill.rs
@@ -1,17 +1,19 @@
-use crate::components::Avatar;
 use adw::subclass::prelude::*;
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
-use gtk::{glib, CompositeTemplate};
+use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
-use crate::prelude::*;
-use crate::session::{Room, User};
+use crate::{
+    components::Avatar,
+    prelude::*,
+    session::{Room, User},
+};
 
 mod imp {
-    use super::*;
-    use glib::subclass::InitializingObject;
     use std::cell::RefCell;
 
+    use glib::subclass::InitializingObject;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/pill.ui")]
     pub struct Pill {
diff --git a/src/components/reaction_chooser.rs b/src/components/reaction_chooser.rs
index 7bddd94f..87e1aad1 100644
--- a/src/components/reaction_chooser.rs
+++ b/src/components/reaction_chooser.rs
@@ -49,10 +49,12 @@ static QUICK_REACTIONS: &[ReactionGridItem] = &[
 
 mod imp {
 
-    use super::*;
-    use glib::subclass::InitializingObject;
     use std::{cell::RefCell, collections::HashMap};
 
+    use glib::subclass::InitializingObject;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/components-reaction-chooser.ui")]
     pub struct ReactionChooser {
diff --git a/src/components/room_title.rs b/src/components/room_title.rs
index 6f9dda09..92209ed6 100644
--- a/src/components/room_title.rs
+++ b/src/components/room_title.rs
@@ -1,14 +1,14 @@
 use adw::subclass::prelude::*;
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
-use gtk::{glib, CompositeTemplate};
+use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 use html2pango::markup;
 
 mod imp {
-    use super::*;
-    use glib::subclass::InitializingObject;
     use std::cell::RefCell;
 
+    use glib::subclass::InitializingObject;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/room-title.ui")]
     pub struct RoomTitle {
@@ -107,7 +107,8 @@ impl RoomTitle {
         let priv_ = imp::RoomTitle::from_instance(self);
         // Parse and escape markup in title
         let title = title.map(|s| markup(&s));
-        // If there's an existing title, check that current title and new title aren't equal
+        // If there's an existing title, check that current title and new title aren't
+        // equal
         if priv_.title.borrow().as_deref() != title.as_deref() {
             priv_.title.replace(title);
             priv_
@@ -127,7 +128,8 @@ impl RoomTitle {
         let priv_ = imp::RoomTitle::from_instance(self);
         // Parse and escape markup in subtitle
         let subtitle = subtitle.map(|s| markup(&s));
-        // If there's an existing subtitle, check that current subtitle and new subtitle aren't equal
+        // If there's an existing subtitle, check that current subtitle and new subtitle
+        // aren't equal
         if priv_.subtitle.borrow().as_deref() != subtitle.as_deref() {
             priv_.subtitle.replace(subtitle);
             priv_
diff --git a/src/components/spinner_button.rs b/src/components/spinner_button.rs
index 40cf2fbe..9debb494 100644
--- a/src/components/spinner_button.rs
+++ b/src/components/spinner_button.rs
@@ -1,12 +1,11 @@
 use adw::subclass::prelude::*;
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
-use gtk::{glib, CompositeTemplate};
+use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/spinner-button.ui")]
     pub struct SpinnerButton {
diff --git a/src/components/video_player.rs b/src/components/video_player.rs
index 5eb142e5..90663dd9 100644
--- a/src/components/video_player.rs
+++ b/src/components/video_player.rs
@@ -2,10 +2,12 @@ use adw::subclass::prelude::*;
 use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 mod imp {
-    use super::*;
+    use std::cell::{Cell, RefCell};
+
     use glib::subclass::InitializingObject;
     use once_cell::sync::Lazy;
-    use std::cell::{Cell, RefCell};
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/components-video-player.ui")]
diff --git a/src/contrib/mod.rs b/src/contrib/mod.rs
index ab641686..f6b74ebd 100644
--- a/src/contrib/mod.rs
+++ b/src/contrib/mod.rs
@@ -1,5 +1,7 @@
 mod qr_code;
 mod qr_code_scanner;
 
-pub use self::qr_code::{QRCode, QRCodeExt};
-pub use self::qr_code_scanner::{screenshot, QrCodeScanner};
+pub use self::{
+    qr_code::{QRCode, QRCodeExt},
+    qr_code_scanner::{screenshot, QrCodeScanner},
+};
diff --git a/src/contrib/qr_code.rs b/src/contrib/qr_code.rs
index 6771bea0..cafec831 100644
--- a/src/contrib/qr_code.rs
+++ b/src/contrib/qr_code.rs
@@ -1,18 +1,16 @@
 // Taken from https://gitlab.gnome.org/msandova/trinket/-/blob/master/src/qr_code.rs
 // All credit goes to Maximiliano
-use gtk::glib;
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
-
 use std::convert::TryFrom;
 
+use gtk::{glib, prelude::*, subclass::prelude::*};
+
 pub(crate) mod imp {
-    use super::*;
+    use std::cell::{Cell, RefCell};
 
     use gtk::{gdk, graphene};
-
     use once_cell::sync::Lazy;
-    use std::cell::{Cell, RefCell};
+
+    use super::*;
 
     #[derive(Debug, Default)]
     pub struct QRCode {
diff --git a/src/contrib/qr_code_scanner/camera_paintable.rs b/src/contrib/qr_code_scanner/camera_paintable.rs
index 766c5ddf..50aaa593 100644
--- a/src/contrib/qr_code_scanner/camera_paintable.rs
+++ b/src/contrib/qr_code_scanner/camera_paintable.rs
@@ -9,21 +9,21 @@
 //                         \
 //                            queue -- videoconvert -- our fancy sink
 
+use std::{
+    os::unix::io::AsRawFd,
+    sync::{Arc, Mutex},
+};
+
 use glib::{clone, Receiver, Sender};
 use gst::prelude::*;
-use gtk::gdk::prelude::TextureExt;
-use gtk::glib;
-use gtk::glib::subclass::prelude::*;
-use gtk::{prelude::*, subclass::prelude::*};
+use gtk::{
+    gdk, gdk::prelude::TextureExt, glib, glib::subclass::prelude::*, graphene, prelude::*,
+    subclass::prelude::*,
+};
+use matrix_sdk::encryption::verification::QrVerificationData;
 use once_cell::sync::Lazy;
 
-use std::os::unix::io::AsRawFd;
-use std::sync::{Arc, Mutex};
-
-use crate::contrib::qr_code_scanner::qr_code_detector::QrCodeDetector;
-use crate::contrib::qr_code_scanner::QrVerificationDataBoxed;
-use gtk::{gdk, graphene};
-use matrix_sdk::encryption::verification::QrVerificationData;
+use crate::contrib::qr_code_scanner::{qr_code_detector::QrCodeDetector, QrVerificationDataBoxed};
 
 pub enum Action {
     FrameChanged,
@@ -207,9 +207,10 @@ mod camera_sink {
 }
 
 mod imp {
-    use glib::subclass;
     use std::cell::RefCell;
 
+    use glib::subclass;
+
     use super::*;
 
     pub struct CameraPaintable {
@@ -293,7 +294,8 @@ mod imp {
             let snapshot = snapshot.downcast_ref::<gtk::Snapshot>().unwrap();
 
             if let Some(ref image) = *self.image.borrow() {
-                // Transformation to avoid stretching the camera. We translate and scale the image.
+                // Transformation to avoid stretching the camera. We translate and scale the
+                // image.
 
                 let aspect = width / height.max(std::f64::EPSILON); // Do not divide by zero.
                 let image_aspect = image.intrinsic_aspect_ratio();
diff --git a/src/contrib/qr_code_scanner/mod.rs b/src/contrib/qr_code_scanner/mod.rs
index 630e8d1b..63e7fdf6 100644
--- a/src/contrib/qr_code_scanner/mod.rs
+++ b/src/contrib/qr_code_scanner/mod.rs
@@ -1,13 +1,12 @@
 // SPDX-License-Identifier: GPL-3.0-or-later
-use crate::spawn;
+use std::os::unix::prelude::RawFd;
+
 use ashpd::{desktop::camera, zbus};
-use glib::clone;
-use glib::subclass;
-use gtk::glib;
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
+use glib::{clone, subclass};
+use gtk::{glib, prelude::*, subclass::prelude::*};
 use matrix_sdk::encryption::verification::QrVerificationData;
-use std::os::unix::prelude::RawFd;
+
+use crate::spawn;
 
 mod camera_paintable;
 mod qr_code_detector;
@@ -16,10 +15,11 @@ pub mod screenshot;
 use camera_paintable::CameraPaintable;
 
 mod imp {
+    use std::cell::Cell;
+
     use adw::subclass::prelude::*;
     use gtk::CompositeTemplate;
     use once_cell::sync::Lazy;
-    use std::cell::Cell;
     use tokio::sync::OnceCell;
 
     use super::*;
diff --git a/src/contrib/qr_code_scanner/qr_code_detector.rs b/src/contrib/qr_code_scanner/qr_code_detector.rs
index cdbb48a5..47ea6ab8 100644
--- a/src/contrib/qr_code_scanner/qr_code_detector.rs
+++ b/src/contrib/qr_code_scanner/qr_code_detector.rs
@@ -1,12 +1,12 @@
-use crate::contrib::qr_code_scanner::camera_paintable::Action;
-use matrix_sdk::encryption::verification::QrVerificationData;
+use std::convert::AsRef;
 
 use glib::Sender;
 use gst_video::{video_frame::VideoFrameRef, VideoInfo};
 use log::debug;
-use std::convert::AsRef;
+use matrix_sdk::encryption::verification::QrVerificationData;
 
 use super::*;
+use crate::contrib::qr_code_scanner::camera_paintable::Action;
 
 mod imp {
     use std::sync::Mutex;
diff --git a/src/contrib/qr_code_scanner/screenshot.rs b/src/contrib/qr_code_scanner/screenshot.rs
index d40a7693..961432ef 100644
--- a/src/contrib/qr_code_scanner/screenshot.rs
+++ b/src/contrib/qr_code_scanner/screenshot.rs
@@ -1,6 +1,5 @@
 use ashpd::desktop::screenshot;
-use gtk::gio;
-use gtk::prelude::*;
+use gtk::{gio, prelude::*};
 use matrix_sdk::encryption::verification::QrVerificationData;
 
 pub async fn capture(root: &gtk::Root) -> Option<QrVerificationData> {
diff --git a/src/error.rs b/src/error.rs
index 1404c034..f32ebc46 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -3,9 +3,10 @@ use gtk::{glib, subclass::prelude::*};
 type WidgetBuilderFn = Box<dyn Fn(&super::Error) -> Option<gtk::Widget> + 'static>;
 
 mod imp {
-    use super::*;
     use std::cell::RefCell;
 
+    use super::*;
+
     #[derive(Default)]
     pub struct Error {
         pub widget_builder: RefCell<Option<WidgetBuilderFn>>,
@@ -33,7 +34,8 @@ impl Error {
         obj
     }
 
-    /// Set a function that builds the widget used to display this error in the UI
+    /// Set a function that builds the widget used to display this error in the
+    /// UI
     pub fn set_widget_builder<F: Fn(&Self) -> Option<gtk::Widget> + 'static>(&self, f: F) {
         let priv_ = imp::Error::from_instance(self);
         priv_.widget_builder.replace(Some(Box::new(f)));
diff --git a/src/login.rs b/src/login.rs
index 91cc41ea..be09aec2 100644
--- a/src/login.rs
+++ b/src/login.rs
@@ -1,19 +1,21 @@
-use crate::Session;
-
 use adw::subclass::prelude::BinImpl;
-use gtk::subclass::prelude::*;
-use gtk::{self, prelude::*};
-use gtk::{glib, glib::clone, CompositeTemplate};
+use gtk::{self, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 use log::debug;
 use url::{ParseError, Url};
 
+use crate::Session;
+
 mod imp {
-    use super::*;
-    use glib::subclass::{InitializingObject, Signal};
-    use glib::SignalHandlerId;
-    use once_cell::sync::Lazy;
     use std::cell::RefCell;
 
+    use glib::{
+        subclass::{InitializingObject, Signal},
+        SignalHandlerId,
+    };
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/login.ui")]
     pub struct Login {
diff --git a/src/main.rs b/src/main.rs
index 163e9365..c7892e6c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -17,20 +17,16 @@ mod user_facing_error;
 mod utils;
 mod window;
 
-use self::application::Application;
-use self::error::Error;
-use self::login::Login;
-use self::session::Session;
-use self::user_facing_error::UserFacingError;
-use self::window::Window;
-
 use config::{GETTEXT_PACKAGE, LOCALEDIR, RESOURCES_FILE};
 use gettextrs::*;
-use gtk::gdk::Display;
-use gtk::gio;
-use gtk::IconTheme;
+use gtk::{gdk::Display, gio, IconTheme};
 use once_cell::sync::Lazy;
 
+use self::{
+    application::Application, error::Error, login::Login, session::Session,
+    user_facing_error::UserFacingError, window::Window,
+};
+
 /// The default tokio runtime to be used for async tasks
 pub static RUNTIME: Lazy<tokio::runtime::Runtime> =
     Lazy::new(|| tokio::runtime::Runtime::new().unwrap());
diff --git a/src/secret.rs b/src/secret.rs
index 9e18997c..f504676a 100644
--- a/src/secret.rs
+++ b/src/secret.rs
@@ -1,11 +1,10 @@
+use std::{path::PathBuf, string::FromUtf8Error};
+
 use gettextrs::gettext;
 use matrix_sdk::ruma::identifiers::{DeviceId, UserId};
-use secret_service::EncryptionType;
-use secret_service::SecretService;
+use secret_service::{EncryptionType, SecretService};
 use serde::{Deserialize, Serialize};
 use serde_json::error::Error as JsonError;
-use std::path::PathBuf;
-use std::string::FromUtf8Error;
 use url::Url;
 
 use crate::config::APP_ID;
@@ -90,8 +89,8 @@ pub fn restore_sessions() -> Result<Vec<StoredSession>, secret_service::Error> {
     Ok(res)
 }
 
-/// Writes a session to the `SecretService`, overwriting any previously stored session with the
-/// same `homeserver`, `username` and `device-id`.
+/// Writes a session to the `SecretService`, overwriting any previously stored
+/// session with the same `homeserver`, `username` and `device-id`.
 pub fn store_session(session: &StoredSession) -> Result<(), secret_service::Error> {
     let ss = SecretService::new(EncryptionType::Dh)?;
     let collection = get_default_collection_unlocked(&ss)?;
diff --git a/src/session/account_settings/devices_page/device.rs 
b/src/session/account_settings/devices_page/device.rs
index de44a7f0..34e21a8b 100644
--- a/src/session/account_settings/devices_page/device.rs
+++ b/src/session/account_settings/devices_page/device.rs
@@ -1,7 +1,5 @@
 use gtk::{glib, prelude::*, subclass::prelude::*};
-
-use crate::components::AuthDialog;
-use crate::session::Session;
+use log::error;
 use matrix_sdk::{
     encryption::identities::Device as CryptoDevice,
     ruma::{
@@ -11,13 +9,14 @@ use matrix_sdk::{
     },
 };
 
-use log::error;
+use crate::{components::AuthDialog, session::Session};
 
 mod imp {
-    use super::*;
     use glib::object::WeakRef;
     use once_cell::{sync::Lazy, unsync::OnceCell};
 
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct Device {
         pub device: OnceCell<MatrixDevice>,
diff --git a/src/session/account_settings/devices_page/device_item.rs 
b/src/session/account_settings/devices_page/device_item.rs
index 76c6dc2c..e63645c9 100644
--- a/src/session/account_settings/devices_page/device_item.rs
+++ b/src/session/account_settings/devices_page/device_item.rs
@@ -21,9 +21,10 @@ impl From<ItemType> for BoxedItemType {
 }
 
 mod imp {
-    use super::*;
     use once_cell::{sync::Lazy, unsync::OnceCell};
 
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct Item {
         pub type_: OnceCell<ItemType>,
diff --git a/src/session/account_settings/devices_page/device_list.rs 
b/src/session/account_settings/devices_page/device_list.rs
index 9124c92c..7c650bcb 100644
--- a/src/session/account_settings/devices_page/device_list.rs
+++ b/src/session/account_settings/devices_page/device_list.rs
@@ -1,18 +1,19 @@
 use gettextrs::gettext;
 use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
 use log::error;
-use matrix_sdk::encryption::identities::UserDevices as CryptoDevices;
-use matrix_sdk::ruma::api::client::r0::device::Device as MatrixDevice;
-use matrix_sdk::Error;
-
-use crate::{session::Session, spawn, spawn_tokio};
+use matrix_sdk::{
+    encryption::identities::UserDevices as CryptoDevices,
+    ruma::api::client::r0::device::Device as MatrixDevice, Error,
+};
 
 use super::{Device, DeviceItem};
+use crate::{session::Session, spawn, spawn_tokio};
 
 mod imp {
+    use std::cell::{Cell, RefCell};
+
     use glib::object::WeakRef;
     use once_cell::{sync::Lazy, unsync::OnceCell};
-    use std::cell::{Cell, RefCell};
 
     use super::*;
 
diff --git a/src/session/account_settings/devices_page/device_row.rs 
b/src/session/account_settings/devices_page/device_row.rs
index 998aedcf..05f2d558 100644
--- a/src/session/account_settings/devices_page/device_row.rs
+++ b/src/session/account_settings/devices_page/device_row.rs
@@ -2,14 +2,15 @@ use gettextrs::gettext;
 use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 use super::Device;
-use crate::components::SpinnerButton;
-use crate::spawn;
+use crate::{components::SpinnerButton, spawn};
 
 mod imp {
-    use super::*;
+    use std::cell::RefCell;
+
     use glib::subclass::InitializingObject;
     use once_cell::sync::Lazy;
-    use std::cell::RefCell;
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/account-settings-device-row.ui")]
@@ -127,7 +128,7 @@ impl DeviceRow {
 
             priv_.verified_icon.set_visible(device.is_verified());
             // TODO: Implement verification
-            //priv_.verify_button.set_visible(!device.is_verified());
+            // priv_.verify_button.set_visible(!device.is_verified());
 
             if let Some(last_seen_ip) = device.last_seen_ip() {
                 priv_.last_seen_ip.set_label(last_seen_ip);
diff --git a/src/session/account_settings/devices_page/mod.rs 
b/src/session/account_settings/devices_page/mod.rs
index 905ecefe..5fe1358e 100644
--- a/src/session/account_settings/devices_page/mod.rs
+++ b/src/session/account_settings/devices_page/mod.rs
@@ -9,16 +9,17 @@ mod device_item;
 use self::device_item::Item as DeviceItem;
 mod device_list;
 use self::device_list::DeviceList;
+use crate::{
+    components::LoadingListBoxRow,
+    session::{user::UserExt, User},
+};
 
-use crate::components::LoadingListBoxRow;
+mod imp {
+    use std::cell::RefCell;
 
-use crate::session::user::UserExt;
-use crate::session::User;
+    use glib::subclass::InitializingObject;
 
-mod imp {
     use super::*;
-    use glib::subclass::InitializingObject;
-    use std::cell::RefCell;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/account-settings-devices-page.ui")]
diff --git a/src/session/account_settings/mod.rs b/src/session/account_settings/mod.rs
index 59ba668d..1ca05c7c 100644
--- a/src/session/account_settings/mod.rs
+++ b/src/session/account_settings/mod.rs
@@ -7,10 +7,12 @@ use devices_page::DevicesPage;
 use crate::session::User;
 
 mod imp {
-    use super::*;
-    use glib::subclass::InitializingObject;
     use std::cell::RefCell;
 
+    use glib::subclass::InitializingObject;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/account-settings.ui")]
     pub struct AccountSettings {
diff --git a/src/session/avatar.rs b/src/session/avatar.rs
index 59acb9d6..2c4bc426 100644
--- a/src/session/avatar.rs
+++ b/src/session/avatar.rs
@@ -1,26 +1,27 @@
 use std::path::Path;
 
 use gtk::{gdk, gio, glib, glib::clone, prelude::*, subclass::prelude::*};
-
 use log::{debug, error, info};
-use matrix_sdk::room::Room as MatrixRoom;
-use matrix_sdk::ruma::events::room::avatar::RoomAvatarEventContent;
-use matrix_sdk::ruma::events::AnyStateEventContent;
-use matrix_sdk::Client;
 use matrix_sdk::{
     media::{MediaFormat, MediaRequest, MediaThumbnailSize, MediaType},
-    ruma::{api::client::r0::media::get_content_thumbnail::Method, identifiers::MxcUri},
+    room::Room as MatrixRoom,
+    ruma::{
+        api::client::r0::media::get_content_thumbnail::Method,
+        events::{room::avatar::RoomAvatarEventContent, AnyStateEventContent},
+        identifiers::MxcUri,
+    },
+    Client,
 };
 
-use crate::{spawn, spawn_tokio};
-
-use crate::session::Session;
+use crate::{session::Session, spawn, spawn_tokio};
 
 mod imp {
-    use super::*;
+    use std::cell::{Cell, RefCell};
+
     use glib::object::WeakRef;
     use once_cell::{sync::Lazy, unsync::OnceCell};
-    use std::cell::{Cell, RefCell};
+
+    use super::*;
 
     #[derive(Debug, Default)]
     pub struct Avatar {
diff --git a/src/session/content/explore/mod.rs b/src/session/content/explore/mod.rs
index f515c30b..3d198c68 100644
--- a/src/session/content/explore/mod.rs
+++ b/src/session/content/explore/mod.rs
@@ -2,25 +2,24 @@ mod public_room;
 mod public_room_list;
 mod public_room_row;
 
-pub use self::public_room::PublicRoom;
-pub use self::public_room_list::PublicRoomList;
-pub use self::public_room_row::PublicRoomRow;
-
 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::{spawn, spawn_tokio};
+pub use self::{
+    public_room::PublicRoom, public_room_list::PublicRoomList, public_room_row::PublicRoomRow,
+};
+use crate::{session::Session, spawn, spawn_tokio};
 
 mod imp {
-    use super::*;
-    use glib::object::WeakRef;
-    use glib::subclass::InitializingObject;
-    use once_cell::sync::Lazy;
     use std::cell::{Cell, RefCell};
 
+    use glib::{object::WeakRef, subclass::InitializingObject};
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-explore.ui")]
     pub struct Explore {
diff --git a/src/session/content/explore/public_room.rs b/src/session/content/explore/public_room.rs
index c9b177ff..3d3c998d 100644
--- a/src/session/content/explore/public_room.rs
+++ b/src/session/content/explore/public_room.rs
@@ -7,10 +7,12 @@ use matrix_sdk::ruma::{
 use crate::session::{room::Room, Avatar, RoomList};
 
 mod imp {
-    use super::*;
+    use std::cell::{Cell, RefCell};
+
     use glib::signal::SignalHandlerId;
     use once_cell::{sync::Lazy, unsync::OnceCell};
-    use std::cell::{Cell, RefCell};
+
+    use super::*;
 
     #[derive(Debug, Default)]
     pub struct PublicRoom {
diff --git a/src/session/content/explore/public_room_list.rs b/src/session/content/explore/public_room_list.rs
index a98ddd11..7e179ae7 100644
--- a/src/session/content/explore/public_room_list.rs
+++ b/src/session/content/explore/public_room_list.rs
@@ -1,25 +1,27 @@
-use crate::{
-    session::{content::explore::PublicRoom, Session},
-    spawn, spawn_tokio,
-};
+use std::convert::TryFrom;
+
 use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
 use log::error;
 use matrix_sdk::ruma::{
-    api::client::r0::directory::{
-        get_public_rooms_filtered::Request as PublicRoomsRequest,
-        get_public_rooms_filtered::Response as PublicRoomsResponse,
+    api::client::r0::directory::get_public_rooms_filtered::{
+        Request as PublicRoomsRequest, Response as PublicRoomsResponse,
     },
     assign,
     directory::{Filter, RoomNetwork},
     identifiers::ServerName,
     uint,
 };
-use std::convert::TryFrom;
+
+use crate::{
+    session::{content::explore::PublicRoom, Session},
+    spawn, spawn_tokio,
+};
 
 mod imp {
+    use std::cell::{Cell, RefCell};
+
     use glib::object::WeakRef;
     use once_cell::sync::Lazy;
-    use std::cell::{Cell, RefCell};
 
     use super::*;
 
diff --git a/src/session/content/explore/public_room_row.rs b/src/session/content/explore/public_room_row.rs
index bf40f1c5..1af5eede 100644
--- a/src/session/content/explore/public_room_row.rs
+++ b/src/session/content/explore/public_room_row.rs
@@ -1,15 +1,19 @@
-use crate::components::Avatar;
-use crate::{components::SpinnerButton, session::content::explore::PublicRoom};
-use adw::prelude::BinExt;
-use adw::subclass::prelude::BinImpl;
+use adw::{prelude::BinExt, subclass::prelude::BinImpl};
 use gettextrs::gettext;
 use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 
+use crate::{
+    components::{Avatar, SpinnerButton},
+    session::content::explore::PublicRoom,
+};
+
 mod imp {
-    use super::*;
+    use std::cell::RefCell;
+
     use glib::{signal::SignalHandlerId, subclass::InitializingObject};
     use once_cell::sync::Lazy;
-    use std::cell::RefCell;
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-public-room-row.ui")]
diff --git a/src/session/content/invite.rs b/src/session/content/invite.rs
index fd6fe1c4..f66e9f29 100644
--- a/src/session/content/invite.rs
+++ b/src/session/content/invite.rs
@@ -1,16 +1,21 @@
+use adw::subclass::prelude::*;
+use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
+
 use crate::{
     components::{Avatar, LabelWithWidgets, Pill, SpinnerButton},
     session::room::{Room, RoomType},
     spawn,
 };
-use adw::subclass::prelude::*;
-use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 mod imp {
-    use super::*;
+    use std::{
+        cell::{Cell, RefCell},
+        collections::HashSet,
+    };
+
     use glib::{signal::SignalHandlerId, subclass::InitializingObject};
-    use std::cell::{Cell, RefCell};
-    use std::collections::HashSet;
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-invite.ui")]
diff --git a/src/session/content/markdown_popover.rs b/src/session/content/markdown_popover.rs
index e4041f3a..13ccd807 100644
--- a/src/session/content/markdown_popover.rs
+++ b/src/session/content/markdown_popover.rs
@@ -1,10 +1,12 @@
 use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 pub mod imp {
-    use super::*;
-    use glib::subclass::InitializingObject;
     use std::cell::Cell;
 
+    use glib::subclass::InitializingObject;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-markdown-popover.ui")]
     pub struct MarkdownPopover {
diff --git a/src/session/content/mod.rs b/src/session/content/mod.rs
index ecc6eb55..8038042e 100644
--- a/src/session/content/mod.rs
+++ b/src/session/content/mod.rs
@@ -5,30 +5,28 @@ mod room_details;
 mod room_history;
 pub mod verification;
 
-use self::explore::Explore;
-use self::invite::Invite;
-use self::markdown_popover::MarkdownPopover;
-use self::room_details::RoomDetails;
-use self::room_history::RoomHistory;
-use self::verification::IdentityVerificationWidget;
-
-use crate::session::sidebar::{Entry, EntryType};
-
-use crate::session::verification::{IdentityVerification, VerificationMode};
-
 use adw::subclass::prelude::*;
 use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 
-use crate::session::room::{Room, RoomType};
-use crate::session::Session;
+use self::{
+    explore::Explore, invite::Invite, markdown_popover::MarkdownPopover, room_details::RoomDetails,
+    room_history::RoomHistory, verification::IdentityVerificationWidget,
+};
+use crate::session::{
+    room::{Room, RoomType},
+    sidebar::{Entry, EntryType},
+    verification::{IdentityVerification, VerificationMode},
+    Session,
+};
 
 mod imp {
-    use super::*;
-    use glib::object::WeakRef;
-    use glib::{signal::SignalHandlerId, subclass::InitializingObject};
-    use once_cell::sync::Lazy;
     use std::cell::{Cell, RefCell};
 
+    use glib::{object::WeakRef, signal::SignalHandlerId, subclass::InitializingObject};
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content.ui")]
     pub struct Content {
diff --git a/src/session/content/room_details/invite_subpage/invitee.rs 
b/src/session/content/room_details/invite_subpage/invitee.rs
index a3829a13..56acd849 100644
--- a/src/session/content/room_details/invite_subpage/invitee.rs
+++ b/src/session/content/room_details/invite_subpage/invitee.rs
@@ -1,16 +1,15 @@
-use gtk::glib;
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
+use gtk::{glib, prelude::*, subclass::prelude::*};
 use matrix_sdk::ruma::identifiers::{MxcUri, UserId};
 
-use crate::session::user::UserExt;
-use crate::session::{Session, User};
+use crate::session::{user::UserExt, Session, User};
 
 mod imp {
-    use super::*;
-    use once_cell::sync::Lazy;
     use std::cell::{Cell, RefCell};
 
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct Invitee {
         pub invited: Cell<bool>,
diff --git a/src/session/content/room_details/invite_subpage/invitee_list.rs 
b/src/session/content/room_details/invite_subpage/invitee_list.rs
index 798ec554..4b7950e5 100644
--- a/src/session/content/room_details/invite_subpage/invitee_list.rs
+++ b/src/session/content/room_details/invite_subpage/invitee_list.rs
@@ -1,13 +1,17 @@
-use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
-use log::error;
-use matrix_sdk::ruma::{api::client::r0::user_directory::search_users, identifiers::UserId};
-use matrix_sdk::HttpError;
 use std::sync::Arc;
 
-use crate::session::user::UserExt;
-use crate::{session::Room, spawn, spawn_tokio};
+use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
+use log::error;
+use matrix_sdk::{
+    ruma::{api::client::r0::user_directory::search_users, identifiers::UserId},
+    HttpError,
+};
 
 use super::Invitee;
+use crate::{
+    session::{user::UserExt, Room},
+    spawn, spawn_tokio,
+};
 
 #[derive(Debug, Eq, PartialEq, Clone, Copy, glib::Enum)]
 #[repr(u32)]
@@ -27,11 +31,14 @@ impl Default for InviteeListState {
 }
 
 mod imp {
+    use std::{
+        cell::{Cell, RefCell},
+        collections::HashMap,
+    };
+
     use futures::future::AbortHandle;
     use glib::subclass::Signal;
     use once_cell::{sync::Lazy, unsync::OnceCell};
-    use std::cell::{Cell, RefCell};
-    use std::collections::HashMap;
 
     use super::*;
 
diff --git a/src/session/content/room_details/invite_subpage/invitee_row.rs 
b/src/session/content/room_details/invite_subpage/invitee_row.rs
index f6c4b5c0..04341e95 100644
--- a/src/session/content/room_details/invite_subpage/invitee_row.rs
+++ b/src/session/content/room_details/invite_subpage/invitee_row.rs
@@ -1,13 +1,15 @@
+use adw::subclass::prelude::BinImpl;
 use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 use super::Invitee;
-use adw::subclass::prelude::BinImpl;
 
 mod imp {
-    use super::*;
+    use std::cell::RefCell;
+
     use glib::subclass::InitializingObject;
     use once_cell::sync::Lazy;
-    use std::cell::RefCell;
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-invitee-row.ui")]
diff --git a/src/session/content/room_details/invite_subpage/mod.rs 
b/src/session/content/room_details/invite_subpage/mod.rs
index 0f79a086..8b2c0ff3 100644
--- a/src/session/content/room_details/invite_subpage/mod.rs
+++ b/src/session/content/room_details/invite_subpage/mod.rs
@@ -5,21 +5,22 @@ mod invitee;
 use self::invitee::Invitee;
 mod invitee_list;
 mod invitee_row;
-use self::invitee_list::{InviteeList, InviteeListState};
-use self::invitee_row::InviteeRow;
-use crate::components::Pill;
+use self::{
+    invitee_list::{InviteeList, InviteeListState},
+    invitee_row::InviteeRow,
+};
+use crate::{
+    components::{Pill, SpinnerButton},
+    session::{content::RoomDetails, Room, User},
+    spawn,
+};
 
-use crate::components::SpinnerButton;
-use crate::session::User;
-use crate::spawn;
+mod imp {
+    use std::cell::RefCell;
 
-use crate::session::content::RoomDetails;
-use crate::session::Room;
+    use glib::subclass::InitializingObject;
 
-mod imp {
     use super::*;
-    use glib::subclass::InitializingObject;
-    use std::cell::RefCell;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-invite-subpage.ui")]
diff --git a/src/session/content/room_details/member_page/member_menu.rs 
b/src/session/content/room_details/member_page/member_menu.rs
index ce02764f..82ead061 100644
--- a/src/session/content/room_details/member_page/member_menu.rs
+++ b/src/session/content/room_details/member_page/member_menu.rs
@@ -3,11 +3,12 @@ use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
 use crate::session::{room::Member, UserActions, UserExt};
 
 mod imp {
-    use super::*;
-    use once_cell::sync::Lazy;
-    use once_cell::unsync::OnceCell;
     use std::cell::RefCell;
 
+    use once_cell::{sync::Lazy, unsync::OnceCell};
+
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct MemberMenu {
         pub member: RefCell<Option<Member>>,
@@ -141,7 +142,8 @@ impl MemberMenu {
 
     /// Show the menu on the specific button
     ///
-    /// For convenience it allows to set the member for which the popover is shown
+    /// For convenience it allows to set the member for which the popover is
+    /// shown
     pub fn present_popover(&self, button: &gtk::ToggleButton, member: Option<Member>) {
         let priv_ = imp::MemberMenu::from_instance(self);
         let popover = self.popover_menu();
diff --git a/src/session/content/room_details/member_page/member_row.rs 
b/src/session/content/room_details/member_page/member_row.rs
index 37294525..8e61fc56 100644
--- a/src/session/content/room_details/member_page/member_row.rs
+++ b/src/session/content/room_details/member_page/member_row.rs
@@ -1,14 +1,15 @@
+use adw::subclass::prelude::BinImpl;
 use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 
-use crate::session::content::RoomDetails;
-use crate::session::room::Member;
-use adw::subclass::prelude::BinImpl;
+use crate::session::{content::RoomDetails, room::Member};
 
 mod imp {
-    use super::*;
+    use std::cell::RefCell;
+
     use glib::subclass::InitializingObject;
     use once_cell::sync::Lazy;
-    use std::cell::RefCell;
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-member-row.ui")]
diff --git a/src/session/content/room_details/member_page/mod.rs 
b/src/session/content/room_details/member_page/mod.rs
index d61562e6..93397a77 100644
--- a/src/session/content/room_details/member_page/mod.rs
+++ b/src/session/content/room_details/member_page/mod.rs
@@ -1,28 +1,32 @@
-use adw::prelude::*;
-use adw::subclass::prelude::*;
+use adw::{prelude::*, subclass::prelude::*};
 use gettextrs::ngettext;
-use gtk::glib::{self, clone, closure};
-use gtk::subclass::prelude::*;
-use gtk::CompositeTemplate;
+use gtk::{
+    glib::{self, clone, closure},
+    subclass::prelude::*,
+    CompositeTemplate,
+};
 
 mod member_menu;
 mod member_row;
-use self::member_menu::MemberMenu;
-use self::member_row::MemberRow;
-use crate::components::{Avatar, Badge};
-use crate::prelude::*;
-use crate::session::content::RoomDetails;
-use crate::session::room::{Member, RoomAction};
-use crate::session::Room;
-use crate::session::{User, UserActions};
-use crate::spawn;
 use log::warn;
 
+use self::{member_menu::MemberMenu, member_row::MemberRow};
+use crate::{
+    components::{Avatar, Badge},
+    prelude::*,
+    session::{
+        content::RoomDetails,
+        room::{Member, RoomAction},
+        Room, User, UserActions,
+    },
+    spawn,
+};
+
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
-    use once_cell::sync::Lazy;
-    use once_cell::unsync::OnceCell;
+    use once_cell::{sync::Lazy, unsync::OnceCell};
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-member-page.ui")]
diff --git a/src/session/content/room_details/mod.rs b/src/session/content/room_details/mod.rs
index 038d17a2..29d62045 100644
--- a/src/session/content/room_details/mod.rs
+++ b/src/session/content/room_details/mod.rs
@@ -1,29 +1,29 @@
 mod invite_subpage;
 mod member_page;
 
-use adw::prelude::*;
-use adw::subclass::prelude::*;
+use adw::{prelude::*, subclass::prelude::*};
 use gettextrs::gettext;
-use gtk::gdk;
 use gtk::{
+    gdk,
     glib::{self, clone, closure},
     subclass::prelude::*,
     CompositeTemplate,
 };
 use matrix_sdk::ruma::events::EventType;
 
-pub use self::invite_subpage::InviteSubpage;
-pub use self::member_page::MemberPage;
-use crate::components::CustomEntry;
-use crate::session::room::RoomAction;
-use crate::session::{self, Room};
-use crate::utils::{and_expr, or_expr};
+pub use self::{invite_subpage::InviteSubpage, member_page::MemberPage};
+use crate::{
+    components::CustomEntry,
+    session::{self, room::RoomAction, Room},
+    utils::{and_expr, or_expr},
+};
 
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
     use once_cell::unsync::OnceCell;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-room-details.ui")]
     pub struct RoomDetails {
diff --git a/src/session/content/room_history/divider_row.rs b/src/session/content/room_history/divider_row.rs
index 3009cb76..ca7f47ff 100644
--- a/src/session/content/room_history/divider_row.rs
+++ b/src/session/content/room_history/divider_row.rs
@@ -2,9 +2,10 @@ use adw::subclass::prelude::*;
 use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-divider-row.ui")]
     pub struct DividerRow {
diff --git a/src/session/content/room_history/item_row.rs b/src/session/content/room_history/item_row.rs
index 862e8a0a..1d4408b2 100644
--- a/src/session/content/room_history/item_row.rs
+++ b/src/session/content/room_history/item_row.rs
@@ -3,15 +3,21 @@ use gettextrs::gettext;
 use gtk::{gio, glib, glib::clone, subclass::prelude::*};
 use matrix_sdk::ruma::events::AnySyncRoomEvent;
 
-use crate::components::{ContextMenuBin, ContextMenuBinExt, ContextMenuBinImpl, ReactionChooser};
-use crate::session::content::room_history::{message_row::MessageRow, DividerRow, StateRow};
-use crate::session::room::{Event, EventActions, Item, ItemType, ReactionList};
+use crate::{
+    components::{ContextMenuBin, ContextMenuBinExt, ContextMenuBinImpl, ReactionChooser},
+    session::{
+        content::room_history::{message_row::MessageRow, DividerRow, StateRow},
+        room::{Event, EventActions, Item, ItemType, ReactionList},
+    },
+};
 
 mod imp {
-    use super::*;
-    use glib::signal::SignalHandlerId;
     use std::cell::RefCell;
 
+    use glib::signal::SignalHandlerId;
+
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct ItemRow {
         pub item: RefCell<Option<Item>>,
@@ -105,8 +111,9 @@ impl ItemRow {
 
     /// This method sets this row to a new `Item`.
     ///
-    /// It tries to reuse the widget and only update the content whenever possible, but it will
-    /// create a new widget and drop the old one if it has to.
+    /// It tries to reuse the widget and only update the content whenever
+    /// possible, but it will create a new widget and drop the old one if it
+    /// has to.
     fn set_item(&self, item: Option<Item>) {
         let priv_ = imp::ItemRow::from_instance(self);
 
diff --git a/src/session/content/room_history/message_row/file.rs 
b/src/session/content/room_history/message_row/file.rs
index f1b1d7d5..5017ed22 100644
--- a/src/session/content/room_history/message_row/file.rs
+++ b/src/session/content/room_history/message_row/file.rs
@@ -2,10 +2,12 @@ use adw::subclass::prelude::*;
 use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 mod imp {
-    use super::*;
+    use std::cell::{Cell, RefCell};
+
     use glib::subclass::InitializingObject;
     use once_cell::sync::Lazy;
-    use std::cell::{Cell, RefCell};
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-message-file.ui")]
diff --git a/src/session/content/room_history/message_row/mod.rs 
b/src/session/content/room_history/message_row/mod.rs
index 024af95f..36b2b138 100644
--- a/src/session/content/room_history/message_row/mod.rs
+++ b/src/session/content/room_history/message_row/mod.rs
@@ -5,11 +5,13 @@ mod reaction_list;
 mod reply;
 mod text;
 
-use crate::{components::Avatar, spawn, utils::filename_for_mime};
 use adw::{prelude::*, subclass::prelude::*};
 use gettextrs::gettext;
 use gtk::{
-    glib, glib::clone, glib::signal::SignalHandlerId, subclass::prelude::*, CompositeTemplate,
+    glib,
+    glib::{clone, signal::SignalHandlerId},
+    subclass::prelude::*,
+    CompositeTemplate,
 };
 use log::warn;
 use matrix_sdk::ruma::events::{
@@ -21,14 +23,17 @@ use self::{
     file::MessageFile, media::MessageMedia, reaction_list::MessageReactionList,
     reply::MessageReply, text::MessageText,
 };
-use crate::prelude::*;
-use crate::session::room::Event;
+use crate::{
+    components::Avatar, prelude::*, session::room::Event, spawn, utils::filename_for_mime,
+};
 
 mod imp {
-    use super::*;
+    use std::cell::RefCell;
+
     use glib::subclass::InitializingObject;
     use once_cell::sync::Lazy;
-    use std::cell::RefCell;
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-message-row.ui")]
@@ -115,7 +120,7 @@ glib::wrapper! {
         @extends gtk::Widget, adw::Bin, @implements gtk::Accessible;
 }
 
-//TODO
+// TODO
 // - [] Implement widgets to show message events
 impl MessageRow {
     pub fn new() -> Self {
diff --git a/src/session/content/room_history/message_row/reaction.rs 
b/src/session/content/room_history/message_row/reaction.rs
index 65fb9df6..dab6b5a3 100644
--- a/src/session/content/room_history/message_row/reaction.rs
+++ b/src/session/content/room_history/message_row/reaction.rs
@@ -4,10 +4,11 @@ use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 use crate::session::room::ReactionGroup;
 
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
     use once_cell::{sync::Lazy, unsync::OnceCell};
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-message-reaction.ui")]
     pub struct MessageReaction {
diff --git a/src/session/content/room_history/message_row/reaction_list.rs 
b/src/session/content/room_history/message_row/reaction_list.rs
index 1a7dc492..2215888d 100644
--- a/src/session/content/room_history/message_row/reaction_list.rs
+++ b/src/session/content/room_history/message_row/reaction_list.rs
@@ -1,14 +1,14 @@
 use adw::subclass::prelude::*;
 use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
-use crate::session::room::ReactionList;
-
 use super::reaction::MessageReaction;
+use crate::session::room::ReactionList;
 
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-message-reaction-list.ui")]
     pub struct MessageReactionList {
diff --git a/src/session/content/room_history/message_row/reply.rs 
b/src/session/content/room_history/message_row/reply.rs
index 353d2092..9d939733 100644
--- a/src/session/content/room_history/message_row/reply.rs
+++ b/src/session/content/room_history/message_row/reply.rs
@@ -4,9 +4,10 @@ use gtk::{glib, subclass::prelude::*, CompositeTemplate};
 use crate::{components::Pill, session::User};
 
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-message-reply.ui")]
     pub struct MessageReply {
diff --git a/src/session/content/room_history/message_row/text.rs 
b/src/session/content/room_history/message_row/text.rs
index 09f466d2..3477a1bb 100644
--- a/src/session/content/room_history/message_row/text.rs
+++ b/src/session/content/room_history/message_row/text.rs
@@ -28,10 +28,12 @@ static EMOJI_REGEX: Lazy<Regex> = Lazy::new(|| {
 });
 
 mod imp {
-    use super::*;
-    use once_cell::sync::Lazy;
     use std::cell::RefCell;
 
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct MessageText {
         /// The displayed content of the message.
@@ -255,8 +257,8 @@ fn set_label_styles(w: &gtk::Label) {
     w.set_xalign(0.0);
     w.set_valign(gtk::Align::Start);
     w.set_halign(gtk::Align::Fill);
-    // FIXME: We have to be able to allow text selection and override popover menu.
-    // See https://gitlab.gnome.org/GNOME/gtk/-/issues/4606
+    // FIXME: We have to be able to allow text selection and override popover
+    // menu. See https://gitlab.gnome.org/GNOME/gtk/-/issues/4606
     // w.set_selectable(true);
 }
 
diff --git a/src/session/content/room_history/mod.rs b/src/session/content/room_history/mod.rs
index 3258e1e0..83466eee 100644
--- a/src/session/content/room_history/mod.rs
+++ b/src/session/content/room_history/mod.rs
@@ -4,14 +4,12 @@ mod message_row;
 mod state_row;
 mod verification_info_bar;
 
-use self::divider_row::DividerRow;
-use self::item_row::ItemRow;
-use self::state_row::StateRow;
-use self::verification_info_bar::VerificationInfoBar;
-
 use adw::subclass::prelude::*;
 use gtk::{
-    gdk, glib, glib::clone, glib::signal::Inhibit, prelude::*, subclass::prelude::*,
+    gdk, glib,
+    glib::{clone, signal::Inhibit},
+    prelude::*,
+    subclass::prelude::*,
     CompositeTemplate,
 };
 use matrix_sdk::ruma::events::room::message::{
@@ -20,16 +18,26 @@ use matrix_sdk::ruma::events::room::message::{
 };
 use sourceview::prelude::*;
 
-use crate::components::{CustomEntry, Pill, RoomTitle};
-use crate::session::content::{MarkdownPopover, RoomDetails};
-use crate::session::room::{Item, Room, RoomType, Timeline};
-use crate::session::user::UserExt;
+use self::{
+    divider_row::DividerRow, item_row::ItemRow, state_row::StateRow,
+    verification_info_bar::VerificationInfoBar,
+};
+use crate::{
+    components::{CustomEntry, Pill, RoomTitle},
+    session::{
+        content::{MarkdownPopover, RoomDetails},
+        room::{Item, Room, RoomType, Timeline},
+        user::UserExt,
+    },
+};
 
 mod imp {
+    use std::cell::{Cell, RefCell};
+
+    use glib::{signal::SignalHandlerId, subclass::InitializingObject};
+
     use super::*;
     use crate::Application;
-    use glib::{signal::SignalHandlerId, subclass::InitializingObject};
-    use std::cell::{Cell, RefCell};
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-room-history.ui")]
@@ -409,7 +417,8 @@ impl RoomHistory {
                     .or_else(|| {
                         pill.room().map(|room| {
                             (
-                                // No server name needed. matrix.to URIs for mentions aren't routable
+                                // No server name needed. matrix.to URIs for mentions aren't
+                                // routable
                                 room.room_id().matrix_to_url([]).to_string(),
                                 room.display_name(),
                             )
@@ -527,8 +536,9 @@ impl RoomHistory {
     }
 
     fn load_more_messages(&self, adj: &gtk::Adjustment) {
-        // Load more messages when the user gets close to the end of the known room history
-        // Use the page size twice to detect if the user gets close to the end
+        // Load more messages when the user gets close to the end of the known room
+        // history Use the page size twice to detect if the user gets close to
+        // the end
         if let Some(room) = self.room() {
             if adj.value() < adj.page_size() * 2.0
                 || adj.upper() <= adj.page_size() / 2.0
diff --git a/src/session/content/room_history/state_row/creation.rs 
b/src/session/content/room_history/state_row/creation.rs
index 99f9467f..7110e3d5 100644
--- a/src/session/content/room_history/state_row/creation.rs
+++ b/src/session/content/room_history/state_row/creation.rs
@@ -1,13 +1,13 @@
 use adw::{prelude::*, subclass::prelude::*};
 use gettextrs::gettext;
 use gtk::{glib, subclass::prelude::*, CompositeTemplate};
-
 use matrix_sdk::ruma::events::room::create::RoomCreateEventContent;
 
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-state-creation.ui")]
     pub struct StateCreation {
diff --git a/src/session/content/room_history/state_row/mod.rs 
b/src/session/content/room_history/state_row/mod.rs
index 3c0803a8..8abd1254 100644
--- a/src/session/content/room_history/state_row/mod.rs
+++ b/src/session/content/room_history/state_row/mod.rs
@@ -1,9 +1,6 @@
 mod creation;
 mod tombstone;
 
-use self::creation::StateCreation;
-use self::tombstone::StateTombstone;
-
 use adw::{prelude::*, subclass::prelude::*};
 use gettextrs::gettext;
 use gtk::{glib, subclass::prelude::*, CompositeTemplate};
@@ -12,10 +9,13 @@ use matrix_sdk::ruma::events::{
     room::member::MembershipState, AnyStateEventContent, AnySyncStateEvent,
 };
 
+use self::{creation::StateCreation, tombstone::StateTombstone};
+
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-state-row.ui")]
     pub struct StateRow {
@@ -50,7 +50,7 @@ glib::wrapper! {
         @extends gtk::Widget, adw::Bin, @implements gtk::Accessible;
 }
 
-//TODO
+// TODO
 // - [] Implement widgets to show state events
 impl StateRow {
     pub fn new() -> Self {
diff --git a/src/session/content/room_history/state_row/tombstone.rs 
b/src/session/content/room_history/state_row/tombstone.rs
index 9574c0a6..ddb9e8ff 100644
--- a/src/session/content/room_history/state_row/tombstone.rs
+++ b/src/session/content/room_history/state_row/tombstone.rs
@@ -3,9 +3,10 @@ use gtk::{glib, subclass::prelude::*, CompositeTemplate};
 use matrix_sdk::ruma::events::room::tombstone::RoomTombstoneEventContent;
 
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-state-tombstone.ui")]
     pub struct StateTombstone {
diff --git a/src/session/content/room_history/verification_info_bar.rs 
b/src/session/content/room_history/verification_info_bar.rs
index 454fb2a3..c0721527 100644
--- a/src/session/content/room_history/verification_info_bar.rs
+++ b/src/session/content/room_history/verification_info_bar.rs
@@ -1,15 +1,18 @@
 use adw::subclass::prelude::*;
+use gettextrs::gettext;
 use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 
-use crate::session::user::UserExt;
-use crate::session::verification::{IdentityVerification, VerificationState};
-use gettextrs::gettext;
+use crate::session::{
+    user::UserExt,
+    verification::{IdentityVerification, VerificationState},
+};
 mod imp {
-    use super::*;
-    use glib::subclass::InitializingObject;
-    use glib::SignalHandlerId;
     use std::cell::RefCell;
 
+    use glib::{subclass::InitializingObject, SignalHandlerId};
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/content-verification-info-bar.ui")]
     pub struct VerificationInfoBar {
@@ -158,7 +161,8 @@ impl VerificationInfoBar {
             if request.is_finished() {
                 false
             } else if matches!(request.state(), VerificationState::Requested) {
-                // Translators: The value is the display name of the user who wants to be verified
+                // Translators: The value is the display name of the user who wants to be
+                // verified
                 priv_.label.set_markup(&gettext!(
                     "<b>{}</b> wants to be verified",
                     request.user().display_name()
diff --git a/src/session/content/verification/emoji.rs b/src/session/content/verification/emoji.rs
index acfac3f8..9550918b 100644
--- a/src/session/content/verification/emoji.rs
+++ b/src/session/content/verification/emoji.rs
@@ -1,11 +1,11 @@
 use adw::subclass::prelude::*;
-
 use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 use matrix_sdk::encryption::verification::Emoji as MatrixEmoji;
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/verification-emoji.ui")]
     pub struct Emoji {
diff --git a/src/session/content/verification/identity_verification_widget.rs 
b/src/session/content/verification/identity_verification_widget.rs
index dafe25ac..b9d5bd80 100644
--- a/src/session/content/verification/identity_verification_widget.rs
+++ b/src/session/content/verification/identity_verification_widget.rs
@@ -1,27 +1,27 @@
 use adw::subclass::prelude::*;
+use gettextrs::gettext;
 use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 use log::warn;
+use matrix_sdk::encryption::verification::QrVerificationData;
 
 use super::Emoji;
-use crate::components::SpinnerButton;
-use crate::contrib::screenshot;
-use crate::contrib::QRCode;
-use crate::contrib::QRCodeExt;
-use crate::contrib::QrCodeScanner;
-use crate::session::user::UserExt;
-use crate::session::verification::{
-    IdentityVerification, SasData, VerificationMode, VerificationState,
+use crate::{
+    components::SpinnerButton,
+    contrib::{screenshot, QRCode, QRCodeExt, QrCodeScanner},
+    session::{
+        user::UserExt,
+        verification::{IdentityVerification, SasData, VerificationMode, VerificationState},
+    },
+    spawn,
 };
-use crate::spawn;
-use gettextrs::gettext;
-use matrix_sdk::encryption::verification::QrVerificationData;
 
 mod imp {
-    use super::*;
-    use glib::subclass::InitializingObject;
-    use glib::SignalHandlerId;
     use std::cell::RefCell;
 
+    use glib::{subclass::InitializingObject, SignalHandlerId};
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/identity-verification-widget.ui")]
     pub struct IdentityVerificationWidget {
diff --git a/src/session/content/verification/mod.rs b/src/session/content/verification/mod.rs
index b2afd487..d325497a 100644
--- a/src/session/content/verification/mod.rs
+++ b/src/session/content/verification/mod.rs
@@ -2,6 +2,7 @@ mod emoji;
 mod identity_verification_widget;
 mod session_verification;
 
-pub use self::emoji::Emoji;
-pub use self::identity_verification_widget::IdentityVerificationWidget;
-pub use self::session_verification::SessionVerification;
+pub use self::{
+    emoji::Emoji, identity_verification_widget::IdentityVerificationWidget,
+    session_verification::SessionVerification,
+};
diff --git a/src/session/content/verification/session_verification.rs 
b/src/session/content/verification/session_verification.rs
index 37548e37..36c7371d 100644
--- a/src/session/content/verification/session_verification.rs
+++ b/src/session/content/verification/session_verification.rs
@@ -4,21 +4,20 @@ use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate
 use log::error;
 
 use super::IdentityVerificationWidget;
-use crate::components::{AuthDialog, SpinnerButton};
-use crate::session::verification::{IdentityVerification, VerificationState};
-use crate::spawn;
-use crate::Error;
-use crate::Session;
-use crate::Window;
+use crate::{
+    components::{AuthDialog, SpinnerButton},
+    session::verification::{IdentityVerification, VerificationState},
+    spawn, Error, Session, Window,
+};
 
 mod imp {
-    use super::*;
-    use glib::subclass::InitializingObject;
-    use glib::SignalHandlerId;
-    use glib::WeakRef;
-    use once_cell::unsync::OnceCell;
     use std::cell::RefCell;
 
+    use glib::{subclass::InitializingObject, SignalHandlerId, WeakRef};
+    use once_cell::unsync::OnceCell;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/session-verification.ui")]
     pub struct SessionVerification {
diff --git a/src/session/event_source_dialog.rs b/src/session/event_source_dialog.rs
index 7ec7802d..79da3498 100644
--- a/src/session/event_source_dialog.rs
+++ b/src/session/event_source_dialog.rs
@@ -1,13 +1,15 @@
-use crate::session::room::Event;
 use adw::subclass::prelude::*;
 use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 use sourceview::prelude::*;
 
+use crate::session::room::Event;
+
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
     use once_cell::unsync::OnceCell;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/event-source-dialog.ui")]
     pub struct EventSourceDialog {
diff --git a/src/session/media_viewer.rs b/src/session/media_viewer.rs
index e4522e2b..12d99f92 100644
--- a/src/session/media_viewer.rs
+++ b/src/session/media_viewer.rs
@@ -4,17 +4,17 @@ use gtk::{gdk, gio, glib, glib::clone, subclass::prelude::*, CompositeTemplate};
 use log::warn;
 use matrix_sdk::ruma::events::{room::message::MessageType, AnyMessageEventContent};
 
-use crate::{session::room::Event, spawn, utils::cache_dir, Window};
-
 use super::room::EventActions;
+use crate::{session::room::Event, spawn, utils::cache_dir, Window};
 
 mod imp {
-    use super::*;
-    use glib::object::WeakRef;
-    use glib::subclass::InitializingObject;
-    use once_cell::sync::Lazy;
     use std::cell::{Cell, RefCell};
 
+    use glib::{object::WeakRef, subclass::InitializingObject};
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/media-viewer.ui")]
     pub struct MediaViewer {
diff --git a/src/session/mod.rs b/src/session/mod.rs
index 9f42be83..2420a1f0 100644
--- a/src/session/mod.rs
+++ b/src/session/mod.rs
@@ -10,67 +10,71 @@ mod sidebar;
 mod user;
 pub mod verification;
 
-use self::account_settings::AccountSettings;
-pub use self::avatar::Avatar;
-use self::content::verification::SessionVerification;
-use self::content::Content;
-use self::media_viewer::MediaViewer;
-pub use self::room::{Event, Item, Room};
-pub use self::room_creation::RoomCreation;
-use self::room_list::RoomList;
-use self::sidebar::Sidebar;
-pub use self::user::{User, UserActions, UserExt};
-use self::verification::VerificationList;
-use crate::session::sidebar::ItemList;
-
-use crate::secret;
-use crate::secret::Secret;
-use crate::secret::StoredSession;
-use crate::Error;
-use crate::UserFacingError;
-use crate::Window;
-use crate::{spawn, spawn_tokio};
+use std::{convert::TryFrom, fs, time::Duration};
 
 use adw::subclass::prelude::BinImpl;
 use futures::StreamExt;
 use gettextrs::gettext;
-use gtk::subclass::prelude::*;
-use gtk::{self, prelude::*};
 use gtk::{
-    gdk, glib, glib::clone, glib::source::SourceId, glib::SyncSender, CompositeTemplate,
-    SelectionModel,
+    self, gdk, glib,
+    glib::{clone, source::SourceId, SyncSender},
+    prelude::*,
+    subclass::prelude::*,
+    CompositeTemplate, SelectionModel,
 };
 use log::{debug, error, warn};
-use matrix_sdk::ruma::{
-    api::client::r0::{
-        filter::{FilterDefinition, LazyLoadOptions, RoomEventFilter, RoomFilter},
-        session::logout,
-    },
-    assign,
-    identifiers::RoomId,
-};
 use matrix_sdk::{
     config::{ClientConfig, RequestConfig, SyncSettings},
     deserialized_responses::SyncResponse,
-    ruma::api::{
-        client::error::ErrorKind,
-        error::{FromHttpResponseError, ServerError},
+    ruma::{
+        api::{
+            client::{
+                error::ErrorKind,
+                r0::{
+                    filter::{FilterDefinition, LazyLoadOptions, RoomEventFilter, RoomFilter},
+                    session::logout,
+                },
+            },
+            error::{FromHttpResponseError, ServerError},
+        },
+        assign,
+        identifiers::RoomId,
     },
     uuid::Uuid,
     Client, Error as MatrixError, HttpError,
 };
 use rand::{distributions::Alphanumeric, thread_rng, Rng};
-use std::convert::TryFrom;
-use std::fs;
-use std::time::Duration;
 use tokio::task::JoinHandle;
 use url::Url;
 
+use self::{
+    account_settings::AccountSettings,
+    content::{verification::SessionVerification, Content},
+    media_viewer::MediaViewer,
+    room_list::RoomList,
+    sidebar::Sidebar,
+    verification::VerificationList,
+};
+pub use self::{
+    avatar::Avatar,
+    room::{Event, Item, Room},
+    room_creation::RoomCreation,
+    user::{User, UserActions, UserExt},
+};
+use crate::{
+    secret,
+    secret::{Secret, StoredSession},
+    session::sidebar::ItemList,
+    spawn, spawn_tokio, Error, UserFacingError, Window,
+};
+
 mod imp {
-    use super::*;
+    use std::cell::{Cell, RefCell};
+
     use glib::subclass::{InitializingObject, Signal};
     use once_cell::{sync::Lazy, unsync::OnceCell};
-    use std::cell::{Cell, RefCell};
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/session.ui")]
diff --git a/src/session/room/event.rs b/src/session/room/event.rs
index 1144acbd..e2a10d52 100644
--- a/src/session/room/event.rs
+++ b/src/session/room/event.rs
@@ -1,12 +1,21 @@
-use gtk::{glib, glib::clone, glib::DateTime, prelude::*, subclass::prelude::*};
+use std::sync::Arc;
+
+use gtk::{
+    glib,
+    glib::{clone, DateTime},
+    prelude::*,
+    subclass::prelude::*,
+};
 use log::warn;
 use matrix_sdk::{
     deserialized_responses::SyncRoomEvent,
     media::MediaEventContent,
     ruma::{
         events::{
-            room::message::Relation,
-            room::{message::MessageType, redaction::RoomRedactionEventContent},
+            room::{
+                message::{MessageType, Relation},
+                redaction::RoomRedactionEventContent,
+            },
             AnyMessageEventContent, AnyRedactedSyncMessageEvent, AnyRedactedSyncStateEvent,
             AnySyncMessageEvent, AnySyncRoomEvent, AnySyncStateEvent, Unsigned,
         },
@@ -15,7 +24,6 @@ use matrix_sdk::{
     },
     Error as MatrixError,
 };
-use std::sync::Arc;
 
 use crate::{
     session::{
@@ -31,17 +39,19 @@ use crate::{
 pub struct BoxedSyncRoomEvent(SyncRoomEvent);
 
 mod imp {
-    use super::*;
-    use glib::object::WeakRef;
-    use glib::SignalHandlerId;
-    use once_cell::{sync::Lazy, unsync::OnceCell};
     use std::cell::{Cell, RefCell};
 
+    use glib::{object::WeakRef, SignalHandlerId};
+    use once_cell::{sync::Lazy, unsync::OnceCell};
+
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct Event {
         /// The deserialized matrix event
         pub event: RefCell<Option<AnySyncRoomEvent>>,
-        /// The SDK event containing encryption information and the serialized event as `Raw`
+        /// The SDK event containing encryption information and the serialized
+        /// event as `Raw`
         pub pure_event: RefCell<Option<SyncRoomEvent>>,
         /// Events that replace this one, in the order they arrive.
         pub replacing_events: RefCell<Vec<super::Event>>,
@@ -270,7 +280,8 @@ impl Event {
     pub fn original_source(&self) -> String {
         let priv_ = imp::Event::from_instance(self);
 
-        // We have to convert it to a Value, because a RawValue cannot be pretty-printed.
+        // We have to convert it to a Value, because a RawValue cannot be
+        // pretty-printed.
         let json: serde_json::Value = serde_json::from_str(
             priv_
                 .pure_event
@@ -288,7 +299,8 @@ impl Event {
 
     /// The pretty-formatted JSON used for this matrix event.
     ///
-    /// If this matrix event has been replaced, returns the replacing `Event`'s source.
+    /// If this matrix event has been replaced, returns the replacing `Event`'s
+    /// source.
     pub fn source(&self) -> String {
         self.replacement()
             .map(|replacement| replacement.source())
@@ -344,8 +356,8 @@ impl Event {
                     AnyMessageEventContent::Reaction(event) => Some(event.relates_to.event_id),
                     AnyMessageEventContent::RoomMessage(event) => match event.relates_to {
                         Some(relates_to) => match relates_to {
-                            // TODO: Figure out Relation::Annotation(), Relation::Reference() but they are 
pre-specs for now
-                            // See: 
https://github.com/uhoreg/matrix-doc/blob/aggregations-reactions/proposals/2677-reactions.md
+                            // TODO: Figure out Relation::Annotation(), Relation::Reference() but
+                            // they are pre-specs for now See: 
https://github.com/uhoreg/matrix-doc/blob/aggregations-reactions/proposals/2677-reactions.md
                             Relation::Reply { in_reply_to } => Some(in_reply_to.event_id),
                             Relation::Replacement(replacement) => Some(replacement.event_id),
                             _ => None,
@@ -360,7 +372,8 @@ impl Event {
         }
     }
 
-    /// Whether this event is hidden from the user or displayed in the room history.
+    /// Whether this event is hidden from the user or displayed in the room
+    /// history.
     pub fn is_hidden_event(&self) -> bool {
         let priv_ = imp::Event::from_instance(self);
 
@@ -556,8 +569,8 @@ impl Event {
 
     /// The `Event` that replaces this one, if any.
     ///
-    /// If this matrix event has been redacted or replaced, returns the corresponding `Event`,
-    /// otherwise returns `None`.
+    /// If this matrix event has been redacted or replaced, returns the
+    /// corresponding `Event`, otherwise returns `None`.
     pub fn replacement(&self) -> Option<Event> {
         self.replacing_events()
             .iter()
@@ -632,7 +645,8 @@ impl Event {
 
     /// The content to display for this `Event`.
     ///
-    /// If this matrix event has been replaced, returns the replacing `Event`'s content.
+    /// If this matrix event has been replaced, returns the replacing `Event`'s
+    /// content.
     pub fn content(&self) -> Option<AnyMessageEventContent> {
         self.replacement()
             .and_then(|replacement| replacement.content())
@@ -654,9 +668,9 @@ impl Event {
     /// - Image message (`MessageType::Image`).
     /// - Video message (`MessageType::Video`).
     ///
-    /// Returns `Ok((uid, filename, binary_content))` on success, `Err` if an error occurred while
-    /// fetching the content. Panics on an incompatible event. `uid` is a unique identifier for this
-    /// media.
+    /// Returns `Ok((uid, filename, binary_content))` on success, `Err` if an
+    /// error occurred while fetching the content. Panics on an incompatible
+    /// event. `uid` is a unique identifier for this media.
     pub async fn get_media_content(&self) -> Result<(String, String, Vec<u8>), matrix_sdk::Error> {
         if let AnyMessageEventContent::RoomMessage(content) = self.message_content().unwrap() {
             let client = self.room().session().client();
diff --git a/src/session/room/event_actions.rs b/src/session/room/event_actions.rs
index 1f33b585..5301d437 100644
--- a/src/session/room/event_actions.rs
+++ b/src/session/room/event_actions.rs
@@ -130,7 +130,8 @@ where
 
     /// Save the file in `event`.
     ///
-    /// See `Event::get_media_content` for compatible events. Panics on an incompatible event.
+    /// See `Event::get_media_content` for compatible events. Panics on an
+    /// incompatible event.
     fn save_event_file(&self, event: Event) {
         let window: Window = self.root().unwrap().downcast().unwrap();
         spawn!(
@@ -187,7 +188,8 @@ where
 
     /// Open the file in `event`.
     ///
-    /// See `Event::get_media_content` for compatible events. Panics on an incompatible event.
+    /// See `Event::get_media_content` for compatible events. Panics on an
+    /// incompatible event.
     fn open_event_file(&self, event: Event) {
         let window: Window = self.root().unwrap().downcast().unwrap();
         spawn!(
diff --git a/src/session/room/item.rs b/src/session/room/item.rs
index d444d3f9..36a50d92 100644
--- a/src/session/room/item.rs
+++ b/src/session/room/item.rs
@@ -1,9 +1,10 @@
+use std::sync::Arc;
+
 use gtk::{glib, glib::DateTime, prelude::*, subclass::prelude::*};
 use matrix_sdk::ruma::{
     events::AnySyncRoomEvent,
     identifiers::{EventId, UserId},
 };
-use std::sync::Arc;
 
 use crate::session::room::Event;
 
@@ -30,9 +31,10 @@ impl From<ItemType> for BoxedItemType {
 mod imp {
     use std::cell::Cell;
 
-    use super::*;
     use once_cell::{sync::Lazy, unsync::OnceCell};
 
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct Item {
         pub type_: OnceCell<ItemType>,
diff --git a/src/session/room/member.rs b/src/session/room/member.rs
index 4b32341b..c65eaedd 100644
--- a/src/session/room/member.rs
+++ b/src/session/room/member.rs
@@ -1,21 +1,30 @@
-use gtk::glib;
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
-use matrix_sdk::ruma::events::room::member::RoomMemberEventContent;
-use matrix_sdk::ruma::events::{StrippedStateEvent, SyncStateEvent};
-use matrix_sdk::ruma::identifiers::{MxcUri, UserId};
-use matrix_sdk::RoomMember;
-
-use crate::prelude::*;
-use crate::session::room::power_levels::{PowerLevel, POWER_LEVEL_MAX, POWER_LEVEL_MIN};
-use crate::session::room::MemberRole;
-use crate::session::{Room, User};
+use gtk::{glib, prelude::*, subclass::prelude::*};
+use matrix_sdk::{
+    ruma::{
+        events::{room::member::RoomMemberEventContent, StrippedStateEvent, SyncStateEvent},
+        identifiers::{MxcUri, UserId},
+    },
+    RoomMember,
+};
+
+use crate::{
+    prelude::*,
+    session::{
+        room::{
+            power_levels::{PowerLevel, POWER_LEVEL_MAX, POWER_LEVEL_MIN},
+            MemberRole,
+        },
+        Room, User,
+    },
+};
 
 mod imp {
-    use super::*;
-    use once_cell::sync::Lazy;
     use std::cell::Cell;
 
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct Member {
         pub power_level: Cell<PowerLevel>,
diff --git a/src/session/room/member_list.rs b/src/session/room/member_list.rs
index e550cd94..1fc95380 100644
--- a/src/session/room/member_list.rs
+++ b/src/session/room/member_list.rs
@@ -1,15 +1,18 @@
-use crate::session::room::{Member, Room, UserId};
-use gtk::{gio, glib, prelude::*, subclass::prelude::*};
-use indexmap::IndexMap;
 use std::sync::Arc;
 
+use gtk::{gio, glib, prelude::*, subclass::prelude::*};
+use indexmap::IndexMap;
 use matrix_sdk::ruma::events::{room::member::RoomMemberEventContent, SyncStateEvent};
 
+use crate::session::room::{Member, Room, UserId};
+
 mod imp {
-    use super::*;
+    use std::cell::RefCell;
+
     use glib::object::WeakRef;
     use once_cell::{sync::Lazy, unsync::OnceCell};
-    use std::cell::RefCell;
+
+    use super::*;
 
     #[derive(Debug, Default)]
     pub struct MemberList {
@@ -114,8 +117,8 @@ impl MemberList {
         }
         let num_members_added = members.len().saturating_sub(prev_len);
 
-        // We can't have the borrow active when items_changed is emitted because that will probably
-        // cause reads of the members field.
+        // We can't have the borrow active when items_changed is emitted because that
+        // will probably cause reads of the members field.
         std::mem::drop(members);
         if num_members_added > 0 {
             // IndexMap preserves insertion order, so all the new items will be at the end.
@@ -138,8 +141,8 @@ impl MemberList {
             })
             .clone();
 
-        // We can't have the borrow active when items_changed is emitted because that will probably
-        // cause reads of the members field.
+        // We can't have the borrow active when items_changed is emitted because that
+        // will probably cause reads of the members field.
         std::mem::drop(members);
         if was_member_added {
             // IndexMap preserves insertion order so the new member will be at the end.
@@ -151,7 +154,8 @@ impl MemberList {
 
     /// Updates a room member based on the room member state event.
     ///
-    /// Creates a new member first if there is no member matching the given event.
+    /// Creates a new member first if there is no member matching the given
+    /// event.
     pub fn update_member_for_member_event(&self, event: &SyncStateEvent<RoomMemberEventContent>) {
         self.member_by_id(event.sender.clone().into())
             .update_from_member_event(event);
diff --git a/src/session/room/mod.rs b/src/session/room/mod.rs
index 405b8bbc..400bdde1 100644
--- a/src/session/room/mod.rs
+++ b/src/session/room/mod.rs
@@ -11,22 +11,7 @@ mod reaction_list;
 mod room_type;
 mod timeline;
 
-pub use self::event::Event;
-pub use self::event_actions::EventActions;
-pub use self::highlight_flags::HighlightFlags;
-pub use self::item::Item;
-pub use self::item::ItemType;
-pub use self::member::Member;
-pub use self::member_role::MemberRole;
-pub use self::power_levels::{
-    PowerLevel, PowerLevels, RoomAction, POWER_LEVEL_MAX, POWER_LEVEL_MIN,
-};
-pub use self::reaction_group::ReactionGroup;
-pub use self::reaction_list::ReactionList;
-pub use self::room_type::RoomType;
-pub use self::timeline::Timeline;
-use crate::session::User;
-use crate::utils::pending_event_ids;
+use std::{cell::RefCell, convert::TryInto, path::PathBuf, sync::Arc};
 
 use gettextrs::gettext;
 use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*};
@@ -57,26 +42,39 @@ use matrix_sdk::{
     uuid::Uuid,
 };
 use serde_json::value::RawValue;
-use std::cell::RefCell;
-use std::convert::TryInto;
-use std::path::PathBuf;
-use std::sync::Arc;
-
-use crate::components::{LabelWithWidgets, Pill};
-use crate::prelude::*;
-use crate::session::avatar::update_room_avatar_from_file;
-use crate::session::room::member_list::MemberList;
-use crate::session::{Avatar, Session};
-use crate::Error;
-use crate::{spawn, spawn_tokio};
+
+pub use self::{
+    event::Event,
+    event_actions::EventActions,
+    highlight_flags::HighlightFlags,
+    item::{Item, ItemType},
+    member::Member,
+    member_role::MemberRole,
+    power_levels::{PowerLevel, PowerLevels, RoomAction, POWER_LEVEL_MAX, POWER_LEVEL_MIN},
+    reaction_group::ReactionGroup,
+    reaction_list::ReactionList,
+    room_type::RoomType,
+    timeline::Timeline,
+};
+use crate::{
+    components::{LabelWithWidgets, Pill},
+    prelude::*,
+    session::{
+        avatar::update_room_avatar_from_file, room::member_list::MemberList, Avatar, Session, User,
+    },
+    spawn, spawn_tokio,
+    utils::pending_event_ids,
+    Error,
+};
 
 mod imp {
-    use super::*;
-    use glib::object::WeakRef;
-    use glib::subclass::Signal;
-    use once_cell::{sync::Lazy, unsync::OnceCell};
     use std::cell::Cell;
 
+    use glib::{object::WeakRef, subclass::Signal};
+    use once_cell::{sync::Lazy, unsync::OnceCell};
+
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct Room {
         pub room_id: OnceCell<Box<RoomId>>,
@@ -87,7 +85,8 @@ mod imp {
         pub category: Cell<RoomType>,
         pub timeline: OnceCell<Timeline>,
         pub members: OnceCell<MemberList>,
-        /// The user who sent the invite to this room. This is only set when this room is an invitiation.
+        /// The user who sent the invite to this room. This is only set when
+        /// this room is an invitiation.
         pub inviter: RefCell<Option<Member>>,
         pub members_loaded: Cell<bool>,
         pub power_levels: RefCell<PowerLevels>,
@@ -813,7 +812,7 @@ impl Room {
     pub fn append_events(&self, batch: Vec<Event>) {
         let priv_ = imp::Room::from_instance(self);
 
-        //FIXME: notify only when the count has changed
+        // FIXME: notify only when the count has changed
         self.notify_notification_count();
 
         let mut latest_change = self.latest_change();
@@ -1022,7 +1021,8 @@ impl Room {
         }
     }
 
-    /// Creates an expression that is true when the user is allowed the given action.
+    /// Creates an expression that is true when the user is allowed the given
+    /// action.
     pub fn new_allowed_expr(&self, room_action: RoomAction) -> gtk::ClosureExpression {
         let session = self.session();
         let user_id = session.user().unwrap().user_id();
diff --git a/src/session/room/power_levels.rs b/src/session/room/power_levels.rs
index cae816d3..d8318266 100644
--- a/src/session/room/power_levels.rs
+++ b/src/session/room/power_levels.rs
@@ -1,8 +1,7 @@
-use gtk::prelude::*;
-use gtk::subclass::prelude::*;
-use gtk::{glib, glib::closure};
-use matrix_sdk::ruma::events::room::power_levels::RoomPowerLevelsEventContent;
-use matrix_sdk::ruma::events::{EventType, SyncStateEvent};
+use gtk::{glib, glib::closure, prelude::*, subclass::prelude::*};
+use matrix_sdk::ruma::events::{
+    room::power_levels::RoomPowerLevelsEventContent, EventType, SyncStateEvent,
+};
 
 use crate::session::room::Member;
 
@@ -19,10 +18,12 @@ pub const POWER_LEVEL_MAX: i64 = 0x001F_FFFF_FFFF_FFFF;
 pub const POWER_LEVEL_MIN: i64 = -POWER_LEVEL_MAX;
 
 mod imp {
-    use super::*;
-    use once_cell::sync::Lazy;
     use std::cell::RefCell;
 
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct PowerLevels {
         pub content: RefCell<BoxedPowerLevelsEventContent>,
@@ -80,7 +81,8 @@ impl PowerLevels {
         min_level_for_room_action(&content.0, room_action)
     }
 
-    /// Creates an expression that is true when the user is allowed the given action.
+    /// Creates an expression that is true when the user is allowed the given
+    /// action.
     pub fn new_allowed_expr(
         &self,
         member: &Member,
diff --git a/src/session/room/reaction_group.rs b/src/session/room/reaction_group.rs
index 328add38..8b207440 100644
--- a/src/session/room/reaction_group.rs
+++ b/src/session/room/reaction_group.rs
@@ -1,14 +1,15 @@
 use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*};
 
-use crate::session::UserExt;
-
 use super::Event;
+use crate::session::UserExt;
 
 mod imp {
-    use super::*;
+    use std::cell::RefCell;
+
     use indexmap::IndexSet;
     use once_cell::{sync::Lazy, unsync::OnceCell};
-    use std::cell::RefCell;
+
+    use super::*;
 
     #[derive(Debug, Default)]
     pub struct ReactionGroup {
diff --git a/src/session/room/reaction_list.rs b/src/session/room/reaction_list.rs
index bf7532d2..02654025 100644
--- a/src/session/room/reaction_list.rs
+++ b/src/session/room/reaction_list.rs
@@ -6,10 +6,12 @@ use matrix_sdk::ruma::events::AnyMessageEventContent;
 use super::{Event, ReactionGroup};
 
 mod imp {
-    use super::*;
-    use indexmap::IndexMap;
     use std::cell::RefCell;
 
+    use indexmap::IndexMap;
+
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct ReactionList {
         /// The list of reactions grouped by key.
@@ -98,8 +100,8 @@ impl ReactionList {
 
         let num_reactions_added = reactions.len().saturating_sub(prev_len);
 
-        // We can't have the borrow active when items_changed is emitted because that will probably
-        // cause reads of the reactions field.
+        // We can't have the borrow active when items_changed is emitted because that
+        // will probably cause reads of the reactions field.
         std::mem::drop(reactions);
 
         if num_reactions_added > 0 {
diff --git a/src/session/room/timeline.rs b/src/session/room/timeline.rs
index db776d78..be132702 100644
--- a/src/session/room/timeline.rs
+++ b/src/session/room/timeline.rs
@@ -14,19 +14,25 @@ use matrix_sdk::{
     Error as MatrixError,
 };
 
-use crate::session::{
-    room::{Event, Item, ItemType, Room},
-    user::UserExt,
-    verification::{IdentityVerification, VERIFICATION_CREATION_TIMEOUT},
+use crate::{
+    session::{
+        room::{Event, Item, ItemType, Room},
+        user::UserExt,
+        verification::{IdentityVerification, VERIFICATION_CREATION_TIMEOUT},
+    },
+    spawn, spawn_tokio,
 };
-use crate::{spawn, spawn_tokio};
 
 mod imp {
-    use super::*;
+    use std::{
+        cell::{Cell, RefCell},
+        collections::VecDeque,
+    };
+
     use glib::object::WeakRef;
     use once_cell::{sync::Lazy, unsync::OnceCell};
-    use std::cell::{Cell, RefCell};
-    use std::collections::VecDeque;
+
+    use super::*;
 
     #[derive(Debug, Default)]
     pub struct Timeline {
@@ -37,7 +43,8 @@ mod imp {
         pub list: RefCell<VecDeque<Item>>,
         /// A Hashmap linking `EventId` to corresponding `Event`
         pub event_map: RefCell<HashMap<Box<EventId>, Event>>,
-        /// Maps the temporary `EventId` of the pending Event to the real `EventId`
+        /// Maps the temporary `EventId` of the pending Event to the real
+        /// `EventId`
         pub pending_events: RefCell<HashMap<String, Box<EventId>>>,
         pub loading: Cell<bool>,
         pub complete: Cell<bool>,
@@ -169,7 +176,8 @@ impl Timeline {
 
         let last_new_message_date;
 
-        // Insert date divider, this needs to happen before updating the position and headers
+        // Insert date divider, this needs to happen before updating the position and
+        // headers
         let added = {
             let position = position as usize;
             let added = added as usize;
@@ -254,12 +262,14 @@ impl Timeline {
 
             // Update the events after the new events
             for next in list.range((position + added)..) {
-                // After an event with non hiddable header the visibility for headers will be correct
+                // After an event with non hiddable header the visibility for headers will be
+                // correct
                 if !next.can_hide_header() {
                     break;
                 }
 
-                // Once the sender changes we can be sure that the visibility for headers will be correct
+                // Once the sender changes we can be sure that the visibility for headers will
+                // be correct
                 if next.matrix_sender() != previous_sender {
                     next.set_show_header(true);
                     break;
@@ -389,8 +399,8 @@ impl Timeline {
                 }
                 relates_to_event.add_reactions(reactions);
             } else {
-                // Store the new event if the `related_to` event isn't known, we will update the 
`relates_to` once
-                // the `related_to` event is added to the list
+                // Store the new event if the `related_to` event isn't known, we will update the
+                // `relates_to` once the `related_to` event is added to the list
                 let relates_to_event = relates_to_events.entry(relates_to_event_id).or_default();
 
                 let relations_ids: Vec<Box<EventId>> = new_relations
@@ -419,7 +429,8 @@ impl Timeline {
         let index = {
             let index = {
                 let mut list = priv_.list.borrow_mut();
-                // Extend the size of the list so that rust doesn't need to reallocate memory multiple times
+                // Extend the size of the list so that rust doesn't need to reallocate memory
+                // multiple times
                 list.reserve(batch.len());
 
                 if list.is_empty() {
@@ -552,7 +563,8 @@ impl Timeline {
 
         {
             let mut hidden_events: Vec<Event> = vec![];
-            // Extend the size of the list so that rust doesn't need to reallocate memory multiple times
+            // Extend the size of the list so that rust doesn't need to reallocate memory
+            // multiple times
             priv_.list.borrow_mut().reserve(added);
 
             for event in batch {
diff --git a/src/session/room_creation/mod.rs b/src/session/room_creation/mod.rs
index 894fb587..752200cc 100644
--- a/src/session/room_creation/mod.rs
+++ b/src/session/room_creation/mod.rs
@@ -1,13 +1,9 @@
+use std::convert::{TryFrom, TryInto};
+
 use adw::subclass::prelude::*;
 use gettextrs::gettext;
 use gtk::{gdk, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 use log::error;
-use std::convert::{TryFrom, TryInto};
-
-use crate::components::SpinnerButton;
-use crate::session::user::UserExt;
-use crate::session::Session;
-use crate::{spawn, spawn_tokio};
 use matrix_sdk::{
     ruma::{
         api::{
@@ -23,17 +19,22 @@ use matrix_sdk::{
     HttpError,
 };
 
-use crate::UserFacingError;
+use crate::{
+    components::SpinnerButton,
+    session::{user::UserExt, Session},
+    spawn, spawn_tokio, UserFacingError,
+};
 
 // MAX length of room addresses
 const MAX_BYTES: usize = 255;
 
 mod imp {
-    use super::*;
-    use glib::object::WeakRef;
-    use glib::subclass::InitializingObject;
     use std::cell::RefCell;
 
+    use glib::{object::WeakRef, subclass::InitializingObject};
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/room-creation.ui")]
     pub struct RoomCreation {
@@ -343,7 +344,8 @@ impl RoomCreation {
             (true, false)
         };
 
-        // TODO: should we immediately check if the address is available, like element is doing?
+        // TODO: should we immediately check if the address is available, like element
+        // is doing?
 
         if has_error {
             priv_.room_address.add_css_class("error");
diff --git a/src/session/room_list.rs b/src/session/room_list.rs
index ec6d3270..6fbb07db 100644
--- a/src/session/room_list.rs
+++ b/src/session/room_list.rs
@@ -1,5 +1,9 @@
+use std::{cell::Cell, collections::HashSet};
+
+use gettextrs::gettext;
 use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
 use indexmap::map::IndexMap;
+use log::error;
 use matrix_sdk::{
     deserialized_responses::Rooms as ResponseRooms,
     ruma::identifiers::{RoomId, RoomOrAliasId},
@@ -9,17 +13,13 @@ use crate::{
     session::{room::Room, Session},
     spawn, spawn_tokio, Error,
 };
-use gettextrs::gettext;
-use log::error;
-use std::cell::Cell;
-use std::collections::HashSet;
 
 mod imp {
-    use glib::object::WeakRef;
-    use glib::subclass::Signal;
-    use once_cell::{sync::Lazy, unsync::OnceCell};
     use std::cell::RefCell;
 
+    use glib::{object::WeakRef, subclass::Signal};
+    use once_cell::{sync::Lazy, unsync::OnceCell};
+
     use super::*;
 
     #[derive(Debug, Default)]
@@ -208,7 +208,7 @@ impl RoomList {
             list.shift_remove_full(room_id)
         };
 
-        if let Some((position, _, _)) = removed {
+        if let Some((position, ..)) = removed {
             self.items_changed(position as u32, 1, 0);
         }
     }
@@ -236,8 +236,8 @@ impl RoomList {
 
     /// Loads the state from the `Store`.
     ///
-    /// Note that the `Store` currently doesn't store all events, therefore, we aren't really
-    /// loading much via this function.
+    /// Note that the `Store` currently doesn't store all events, therefore, we
+    /// aren't really loading much via this function.
     pub fn load(&self) {
         let priv_ = imp::RoomList::from_instance(self);
         let session = self.session();
diff --git a/src/session/sidebar/account_switcher/add_account.rs 
b/src/session/sidebar/account_switcher/add_account.rs
index 25a31f23..3fcf3986 100644
--- a/src/session/sidebar/account_switcher/add_account.rs
+++ b/src/session/sidebar/account_switcher/add_account.rs
@@ -1,12 +1,11 @@
 use adw::subclass::prelude::BinImpl;
-use gtk::subclass::prelude::*;
-use gtk::{self, prelude::*};
-use gtk::{glib, CompositeTemplate};
+use gtk::{self, glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/add-account-row.ui")]
     pub struct AddAccountRow;
diff --git a/src/session/sidebar/account_switcher/avatar_with_selection.rs 
b/src/session/sidebar/account_switcher/avatar_with_selection.rs
index d6a4ddb1..8af94144 100644
--- a/src/session/sidebar/account_switcher/avatar_with_selection.rs
+++ b/src/session/sidebar/account_switcher/avatar_with_selection.rs
@@ -1,14 +1,14 @@
 use adw::subclass::prelude::*;
 use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
-use crate::components::Avatar;
-use crate::session::Avatar as AvatarItem;
+use crate::{components::Avatar, session::Avatar as AvatarItem};
 
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
     use once_cell::sync::Lazy;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/avatar-with-selection.ui")]
     pub struct AvatarWithSelection {
diff --git a/src/session/sidebar/account_switcher/item.rs b/src/session/sidebar/account_switcher/item.rs
index ef27e0c6..ea845a89 100644
--- a/src/session/sidebar/account_switcher/item.rs
+++ b/src/session/sidebar/account_switcher/item.rs
@@ -1,14 +1,17 @@
-use super::add_account::AddAccountRow;
-use super::user_entry::UserEntryRow;
-use crate::session::Session;
-use gtk::{gio::ListStore, glib, prelude::*, subclass::prelude::*};
 use std::convert::TryFrom;
 
+use gtk::{gio::ListStore, glib, prelude::*, subclass::prelude::*};
+
+use super::{add_account::AddAccountRow, user_entry::UserEntryRow};
+use crate::session::Session;
+
 mod imp {
-    use super::*;
-    use once_cell::sync::Lazy;
     use std::cell::Cell;
 
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct ExtraItemObj(pub Cell<super::ExtraItem>);
 
diff --git a/src/session/sidebar/account_switcher/mod.rs b/src/session/sidebar/account_switcher/mod.rs
index 769054da..56c13cfd 100644
--- a/src/session/sidebar/account_switcher/mod.rs
+++ b/src/session/sidebar/account_switcher/mod.rs
@@ -1,3 +1,5 @@
+use std::convert::TryFrom;
+
 use gtk::{
     gio::{self, ListModel, ListStore},
     glib::{self, clone},
@@ -5,7 +7,6 @@ use gtk::{
     subclass::prelude::*,
     CompositeTemplate, SelectionModel,
 };
-use std::convert::TryFrom;
 
 use super::account_switcher::item::{ExtraItemObj, Item as AccountSwitcherItem};
 use crate::session::Session;
@@ -16,9 +17,10 @@ pub mod item;
 pub mod user_entry;
 
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
 
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/sidebar-account-switcher.ui")]
     pub struct AccountSwitcher {
diff --git a/src/session/sidebar/account_switcher/user_entry.rs 
b/src/session/sidebar/account_switcher/user_entry.rs
index bfe1faa2..f71494d4 100644
--- a/src/session/sidebar/account_switcher/user_entry.rs
+++ b/src/session/sidebar/account_switcher/user_entry.rs
@@ -1,14 +1,16 @@
-use super::avatar_with_selection::AvatarWithSelection;
 use adw::subclass::prelude::BinImpl;
 use gtk::{self, glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
+use super::avatar_with_selection::AvatarWithSelection;
 use crate::session::Session;
 
 mod imp {
-    use super::*;
+    use std::cell::RefCell;
+
     use glib::subclass::InitializingObject;
     use once_cell::sync::Lazy;
-    use std::cell::RefCell;
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/user-entry-row.ui")]
diff --git a/src/session/sidebar/category.rs b/src/session/sidebar/category.rs
index 8c177f43..f64b141e 100644
--- a/src/session/sidebar/category.rs
+++ b/src/session/sidebar/category.rs
@@ -1,12 +1,12 @@
 use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
 
-use crate::session::sidebar::CategoryType;
-use crate::session::{room::Room, room_list::RoomList};
+use crate::session::{room::Room, room_list::RoomList, sidebar::CategoryType};
 
 mod imp {
-    use once_cell::unsync::OnceCell;
     use std::cell::Cell;
 
+    use once_cell::unsync::OnceCell;
+
     use super::*;
 
     #[derive(Debug, Default)]
diff --git a/src/session/sidebar/category_row.rs b/src/session/sidebar/category_row.rs
index bc03b357..519d89e9 100644
--- a/src/session/sidebar/category_row.rs
+++ b/src/session/sidebar/category_row.rs
@@ -1,16 +1,16 @@
 use adw::subclass::prelude::BinImpl;
 use gettextrs::gettext;
-use gtk::subclass::prelude::*;
-use gtk::{self, prelude::*};
-use gtk::{glib, CompositeTemplate};
+use gtk::{self, glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 use crate::session::sidebar::{Category, CategoryType};
 
 mod imp {
-    use super::*;
-    use glib::subclass::InitializingObject;
     use std::cell::{Cell, RefCell};
 
+    use glib::subclass::InitializingObject;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/sidebar-category-row.ui")]
     pub struct CategoryRow {
diff --git a/src/session/sidebar/category_type.rs b/src/session/sidebar/category_type.rs
index b736aa13..165ecd29 100644
--- a/src/session/sidebar/category_type.rs
+++ b/src/session/sidebar/category_type.rs
@@ -1,7 +1,8 @@
-use crate::session::room::RoomType;
 use gettextrs::gettext;
 use gtk::glib;
 
+use crate::session::room::RoomType;
+
 #[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::Enum)]
 #[repr(i32)]
 #[enum_type(name = "CategoryType")]
diff --git a/src/session/sidebar/entry_row.rs b/src/session/sidebar/entry_row.rs
index 3a2e5a14..4af617ce 100644
--- a/src/session/sidebar/entry_row.rs
+++ b/src/session/sidebar/entry_row.rs
@@ -1,15 +1,15 @@
 use adw::subclass::prelude::BinImpl;
-use gtk::subclass::prelude::*;
-use gtk::{self, prelude::*};
-use gtk::{glib, CompositeTemplate};
+use gtk::{self, glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 use crate::session::sidebar::Entry;
 
 mod imp {
-    use super::*;
-    use glib::subclass::InitializingObject;
     use std::cell::RefCell;
 
+    use glib::subclass::InitializingObject;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/sidebar-entry-row.ui")]
     pub struct EntryRow {
diff --git a/src/session/sidebar/item_list.rs b/src/session/sidebar/item_list.rs
index eb51bdc2..809ffbf1 100644
--- a/src/session/sidebar/item_list.rs
+++ b/src/session/sidebar/item_list.rs
@@ -5,17 +5,15 @@ use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
 use crate::session::{
     room::RoomType,
     room_list::RoomList,
-    sidebar::CategoryType,
-    sidebar::EntryType,
-    sidebar::{Category, Entry},
+    sidebar::{Category, CategoryType, Entry, EntryType},
     verification::VerificationList,
 };
 
 mod imp {
-    use once_cell::sync::Lazy;
-    use once_cell::unsync::OnceCell;
     use std::cell::Cell;
 
+    use once_cell::{sync::Lazy, unsync::OnceCell};
+
     use super::*;
 
     #[derive(Debug, Default)]
diff --git a/src/session/sidebar/mod.rs b/src/session/sidebar/mod.rs
index 8815d56a..603c16ac 100644
--- a/src/session/sidebar/mod.rs
+++ b/src/session/sidebar/mod.rs
@@ -11,37 +11,38 @@ mod row;
 mod selection;
 mod verification_row;
 
-pub use self::category::Category;
-use self::category_row::CategoryRow;
-pub use self::category_type::CategoryType;
-pub use self::entry::Entry;
-use self::entry_row::EntryRow;
-pub use self::entry_type::EntryType;
-pub use self::item_list::ItemList;
-use self::room_row::RoomRow;
-use self::row::Row;
-use self::selection::Selection;
-use self::verification_row::VerificationRow;
-
+use account_switcher::AccountSwitcher;
 use adw::{prelude::*, subclass::prelude::*};
 use gtk::{gio, glib, glib::closure, subclass::prelude::*, CompositeTemplate, SelectionModel};
 
-use crate::components::Avatar;
-use crate::session::room::{Room, RoomType};
-use crate::session::verification::IdentityVerification;
-use crate::session::Session;
-use crate::session::User;
-use account_switcher::AccountSwitcher;
+pub use self::{
+    category::Category, category_type::CategoryType, entry::Entry, entry_type::EntryType,
+    item_list::ItemList,
+};
+use self::{
+    category_row::CategoryRow, entry_row::EntryRow, room_row::RoomRow, row::Row,
+    selection::Selection, verification_row::VerificationRow,
+};
+use crate::{
+    components::Avatar,
+    session::{
+        room::{Room, RoomType},
+        verification::IdentityVerification,
+        Session, User,
+    },
+};
 
 mod imp {
-    use super::*;
-    use glib::subclass::InitializingObject;
-    use once_cell::sync::Lazy;
     use std::{
         cell::{Cell, RefCell},
         convert::TryFrom,
     };
 
+    use glib::subclass::InitializingObject;
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/sidebar.ui")]
     pub struct Sidebar {
diff --git a/src/session/sidebar/room_row.rs b/src/session/sidebar/room_row.rs
index a78c9bac..25f5ee70 100644
--- a/src/session/sidebar/room_row.rs
+++ b/src/session/sidebar/room_row.rs
@@ -7,10 +7,12 @@ use crate::{
 };
 
 mod imp {
-    use super::*;
+    use std::cell::RefCell;
+
     use glib::{subclass::InitializingObject, SignalHandlerId};
     use once_cell::sync::Lazy;
-    use std::cell::RefCell;
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/sidebar-room-row.ui")]
diff --git a/src/session/sidebar/row.rs b/src/session/sidebar/row.rs
index 218191f8..3accd405 100644
--- a/src/session/sidebar/row.rs
+++ b/src/session/sidebar/row.rs
@@ -3,19 +3,20 @@ use std::convert::TryFrom;
 use adw::{prelude::*, subclass::prelude::*};
 use gtk::{gdk, glib, glib::clone, subclass::prelude::*};
 
+use super::EntryType;
 use crate::session::{
     room::{Room, RoomType},
     sidebar::{Category, CategoryRow, Entry, EntryRow, RoomRow, VerificationRow},
     verification::IdentityVerification,
 };
 
-use super::EntryType;
-
 mod imp {
-    use super::*;
-    use once_cell::sync::Lazy;
     use std::cell::RefCell;
 
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct Row {
         pub list_row: RefCell<Option<gtk::TreeListRow>>,
diff --git a/src/session/sidebar/selection.rs b/src/session/sidebar/selection.rs
index f4f211e5..87684ea6 100644
--- a/src/session/sidebar/selection.rs
+++ b/src/session/sidebar/selection.rs
@@ -1,10 +1,12 @@
 use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
 
 mod imp {
-    use super::*;
-    use once_cell::sync::Lazy;
     use std::cell::{Cell, RefCell};
 
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
     #[derive(Debug, Default)]
     pub struct Selection {
         pub model: RefCell<Option<gio::ListModel>>,
diff --git a/src/session/sidebar/verification_row.rs b/src/session/sidebar/verification_row.rs
index 95ccd770..7236b927 100644
--- a/src/session/sidebar/verification_row.rs
+++ b/src/session/sidebar/verification_row.rs
@@ -4,10 +4,12 @@ use gtk::{glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 use crate::session::verification::IdentityVerification;
 
 mod imp {
-    use super::*;
+    use std::cell::RefCell;
+
     use glib::subclass::InitializingObject;
     use once_cell::sync::Lazy;
-    use std::cell::RefCell;
+
+    use super::*;
 
     #[derive(Debug, Default, CompositeTemplate)]
     #[template(resource = "/org/gnome/FractalNext/sidebar-verification-row.ui")]
diff --git a/src/session/user.rs b/src/session/user.rs
index 5b47b770..b31237b6 100644
--- a/src/session/user.rs
+++ b/src/session/user.rs
@@ -1,15 +1,19 @@
-use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*};
-use matrix_sdk::ruma::identifiers::{MxcUri, UserId};
-
-use crate::session::{
-    verification::{IdentityVerification, VerificationState},
-    Avatar, Session,
-};
-use crate::{spawn, spawn_tokio};
-use matrix_sdk::encryption::identities::UserIdentity;
 use std::sync::Arc;
 
+use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*};
 use log::error;
+use matrix_sdk::{
+    encryption::identities::UserIdentity,
+    ruma::identifiers::{MxcUri, UserId},
+};
+
+use crate::{
+    session::{
+        verification::{IdentityVerification, VerificationState},
+        Avatar, Session,
+    },
+    spawn, spawn_tokio,
+};
 
 #[glib::flags(name = "UserActions")]
 pub enum UserActions {
@@ -24,10 +28,12 @@ impl Default for UserActions {
 }
 
 mod imp {
-    use super::*;
+    use std::cell::{Cell, RefCell};
+
     use glib::object::WeakRef;
     use once_cell::{sync::Lazy, unsync::OnceCell};
-    use std::cell::{Cell, RefCell};
+
+    use super::*;
 
     #[derive(Debug, Default)]
     pub struct User {
diff --git a/src/session/verification/identity_verification.rs 
b/src/session/verification/identity_verification.rs
index 50b3953b..4ca1fe21 100644
--- a/src/session/verification/identity_verification.rs
+++ b/src/session/verification/identity_verification.rs
@@ -1,10 +1,5 @@
-use super::{VERIFICATION_CREATION_TIMEOUT, VERIFICATION_RECEIVE_TIMEOUT};
-use crate::session::user::UserExt;
-use crate::session::Session;
-use crate::session::User;
-use crate::spawn;
-use crate::spawn_tokio;
-use crate::Error;
+use std::time::Duration;
+
 use gettextrs::gettext;
 use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*};
 use log::{debug, error, warn};
@@ -23,9 +18,14 @@ use matrix_sdk::{
     Client,
 };
 use qrcode::QrCode;
-use std::time::Duration;
 use tokio::sync::mpsc;
 
+use super::{VERIFICATION_CREATION_TIMEOUT, VERIFICATION_RECEIVE_TIMEOUT};
+use crate::{
+    session::{user::UserExt, Session, User},
+    spawn, spawn_tokio, Error,
+};
+
 #[derive(Debug, Eq, PartialEq, Clone, Copy, glib::Enum)]
 #[repr(u32)]
 #[enum_type(name = "VerificationState")]
@@ -120,10 +120,12 @@ pub enum SasData {
 }
 
 mod imp {
-    use super::*;
+    use std::cell::{Cell, RefCell};
+
     use glib::object::WeakRef;
     use once_cell::{sync::Lazy, unsync::OnceCell};
-    use std::cell::{Cell, RefCell};
+
+    use super::*;
 
     #[derive(Default)]
     pub struct IdentityVerification {
@@ -283,7 +285,8 @@ mod imp {
 
             self.main_sender.replace(Some(main_sender));
 
-            // We don't need to track ourselves because we show "Login Request" as name in that case.
+            // We don't need to track ourselves because we show "Login Request" as name in
+            // that case.
             if obj.user() != obj.session().user().unwrap() {
                 obj.user().connect_notify_local(
                     Some("display-name"),
@@ -340,7 +343,8 @@ impl IdentityVerification {
 
     /// Creates and send a new verification request
     ///
-    /// If `User` is `None` a new session verification is started for our own user and send to other devices
+    /// If `User` is `None` a new session verification is started for our own
+    /// user and send to other devices
     pub async fn create(session: &Session, user: Option<&User>) -> Self {
         let (mode, user) = if let Some(user) = user {
             (Mode::User, user)
diff --git a/src/session/verification/mod.rs b/src/session/verification/mod.rs
index 1c1cfa14..35d320b1 100644
--- a/src/session/verification/mod.rs
+++ b/src/session/verification/mod.rs
@@ -1,12 +1,14 @@
 mod identity_verification;
 mod verification_list;
 
-pub use self::identity_verification::{
-    IdentityVerification, Mode as VerificationMode, SasData, State as VerificationState,
-};
-pub use self::verification_list::VerificationList;
-
 use std::time::Duration;
+
+pub use self::{
+    identity_verification::{
+        IdentityVerification, Mode as VerificationMode, SasData, State as VerificationState,
+    },
+    verification_list::VerificationList,
+};
 /// The time a verification is valid after it's creation.
 #[allow(dead_code)]
 pub const VERIFICATION_CREATION_TIMEOUT: Duration = Duration::from_secs(60 * 10);
diff --git a/src/session/verification/verification_list.rs b/src/session/verification/verification_list.rs
index 1f4d3644..f5872f7d 100644
--- a/src/session/verification/verification_list.rs
+++ b/src/session/verification/verification_list.rs
@@ -1,14 +1,16 @@
-use crate::session::user::UserExt;
-use crate::session::{
-    verification::{IdentityVerification, VERIFICATION_CREATION_TIMEOUT},
-    Session,
-};
+use std::sync::Arc;
+
 use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
 use log::{debug, warn};
 use matrix_sdk::ruma::{
     api::client::r0::sync::sync_events::ToDevice, events::AnyToDeviceEvent, identifiers::UserId,
 };
-use std::sync::Arc;
+
+use crate::session::{
+    user::UserExt,
+    verification::{IdentityVerification, VERIFICATION_CREATION_TIMEOUT},
+    Session,
+};
 
 #[derive(Hash, PartialEq, Eq, Debug)]
 pub struct FlowId {
@@ -41,10 +43,11 @@ impl indexmap::Equivalent<FlowId> for FlowIdUnowned<'_> {
 }
 
 mod imp {
+    use std::cell::RefCell;
+
     use glib::object::WeakRef;
     use indexmap::IndexMap;
     use once_cell::{sync::Lazy, unsync::OnceCell};
-    use std::cell::RefCell;
 
     use super::*;
 
@@ -249,7 +252,7 @@ impl VerificationList {
     pub fn remove(&self, request: &IdentityVerification) {
         let priv_ = imp::VerificationList::from_instance(self);
 
-        let position = if let Some((position, _, _)) =
+        let position = if let Some((position, ..)) =
             priv_
                 .list
                 .borrow_mut()
diff --git a/src/user_facing_error.rs b/src/user_facing_error.rs
index 4c1b3a3c..92d294d6 100644
--- a/src/user_facing_error.rs
+++ b/src/user_facing_error.rs
@@ -1,3 +1,4 @@
+use gettextrs::gettext;
 use matrix_sdk::{
     ruma::api::{
         client::error::ErrorKind::{Forbidden, LimitExceeded, UserDeactivated},
@@ -6,8 +7,6 @@ use matrix_sdk::{
     Error, HttpError,
 };
 
-use gettextrs::gettext;
-
 pub trait UserFacingError {
     fn to_user_facing(self) -> String;
 }
@@ -34,7 +33,8 @@ impl UserFacingError for HttpError {
                         }
                     }
                     _ => {
-                        // TODO: The server may not give us pretty enough error message. We should add our 
own error message.
+                        // TODO: The server may not give us pretty enough error message. We should
+                        // add our own error message.
                         error.message
                     }
                 }
diff --git a/src/utils.rs b/src/utils.rs
index f3e7bc33..1d0b4092 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -60,13 +60,13 @@ macro_rules! spawn_tokio {
     };
 }
 
-use std::convert::TryInto;
-use std::path::PathBuf;
-use std::str::FromStr;
+use std::{convert::TryInto, path::PathBuf, str::FromStr};
 
 use gettextrs::gettext;
-use gtk::gio::{self, prelude::*};
-use gtk::glib::{self, closure, Object};
+use gtk::{
+    gio::{self, prelude::*},
+    glib::{self, closure, Object},
+};
 use matrix_sdk::{
     media::MediaType,
     ruma::{EventId, UInt},
@@ -74,7 +74,8 @@ use matrix_sdk::{
 };
 use mime::Mime;
 
-// Returns an expression that is the and’ed result of the given boolean expressions.
+// Returns an expression that is the and’ed result of the given boolean
+// expressions.
 #[allow(dead_code)]
 pub fn and_expr<E: AsRef<gtk::Expression>>(a_expr: E, b_expr: E) -> gtk::ClosureExpression {
     gtk::ClosureExpression::new::<bool, _, _>(
@@ -83,7 +84,8 @@ pub fn and_expr<E: AsRef<gtk::Expression>>(a_expr: E, b_expr: E) -> gtk::Closure
     )
 }
 
-// Returns an expression that is the or’ed result of the given boolean expressions.
+// Returns an expression that is the or’ed result of the given boolean
+// expressions.
 pub fn or_expr<E: AsRef<gtk::Expression>>(a_expr: E, b_expr: E) -> gtk::ClosureExpression {
     gtk::ClosureExpression::new::<bool, _, _>(
         &[a_expr, b_expr],
@@ -91,7 +93,8 @@ pub fn or_expr<E: AsRef<gtk::Expression>>(a_expr: E, b_expr: E) -> gtk::ClosureE
     )
 }
 
-// Returns an expression that is the inverted result of the given boolean expressions.
+// Returns an expression that is the inverted result of the given boolean
+// expressions.
 #[allow(dead_code)]
 pub fn not_expr<E: AsRef<gtk::Expression>>(a_expr: E) -> gtk::ClosureExpression {
     gtk::ClosureExpression::new::<bool, _, _>(
@@ -151,7 +154,8 @@ pub fn style_scheme() -> Option<sourceview::StyleScheme> {
 
 /// Get the unique id of the given `MediaType`.
 ///
-/// It is built from the underlying `MxcUri` and can be safely used in a filename.
+/// It is built from the underlying `MxcUri` and can be safely used in a
+/// filename.
 ///
 /// The id is not guaranteed to be unique for malformed `MxcUri`s.
 pub fn media_type_uid(media_type: Option<MediaType>) -> String {
diff --git a/src/window.rs b/src/window.rs
index 91b0de3d..c13b3404 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -1,22 +1,20 @@
-use crate::components::InAppNotification;
-use crate::config::{APP_ID, PROFILE};
-use crate::secret;
-use crate::Application;
-use crate::Login;
-use crate::Session;
-use crate::{Error, UserFacingError};
 use adw::subclass::prelude::AdwApplicationWindowImpl;
 use gettextrs::gettext;
 use glib::signal::Inhibit;
-use gtk::subclass::prelude::*;
-use gtk::{self, prelude::*};
-use gtk::{gio, glib, glib::clone, CompositeTemplate};
+use gtk::{self, gio, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
 use log::warn;
 
+use crate::{
+    components::InAppNotification,
+    config::{APP_ID, PROFILE},
+    secret, Application, Error, Login, Session, UserFacingError,
+};
+
 mod imp {
-    use super::*;
     use glib::subclass::InitializingObject;
 
+    use super::*;
+
     #[derive(Debug, CompositeTemplate, Default)]
     #[template(resource = "/org/gnome/FractalNext/window.ui")]
     pub struct Window {
@@ -192,7 +190,8 @@ impl Window {
     }
 
     /// Change the default widget of the window based on the visible child
-    /// If the login screen is visible, its login button becomes the default widget
+    /// If the login screen is visible, its login button becomes the default
+    /// widget
     fn set_default_by_child(&self) {
         let priv_ = imp::Window::from_instance(self);
         if priv_.main_stack.visible_child() == Some(priv_.login.get().upcast()) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]