[fractal] Upgrade to Rust 2018
- From: Jordan Petridis <jpetridis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal] Upgrade to Rust 2018
- Date: Sun, 6 Jan 2019 04:40:13 +0000 (UTC)
commit 84b7026b2fe859efdb78218799f9938f8492ce5c
Author: Alejandro DomÃnguez <adomu net-c com>
Date: Fri Dec 28 17:58:23 2018 +0100
Upgrade to Rust 2018
Cargo.lock | 5 ++-
fractal-gtk/Cargo.toml | 11 +++---
fractal-gtk/src/actions/global.rs | 6 ++-
fractal-gtk/src/actions/room_history.rs | 15 ++++----
fractal-gtk/src/app/backend_loop.rs | 11 +++---
fractal-gtk/src/app/connect/account.rs | 5 ++-
fractal-gtk/src/app/connect/attach.rs | 2 +-
fractal-gtk/src/app/connect/autocomplete.rs | 4 +-
fractal-gtk/src/app/connect/direct.rs | 3 +-
fractal-gtk/src/app/connect/directory.rs | 5 ++-
fractal-gtk/src/app/connect/headerbar.rs | 3 +-
fractal-gtk/src/app/connect/invite.rs | 3 +-
fractal-gtk/src/app/connect/join_room.rs | 3 +-
fractal-gtk/src/app/connect/leave_room.rs | 3 +-
fractal-gtk/src/app/connect/login.rs | 2 +-
fractal-gtk/src/app/connect/markdown.rs | 4 +-
fractal-gtk/src/app/connect/mod.rs | 2 +-
fractal-gtk/src/app/connect/new_room.rs | 3 +-
fractal-gtk/src/app/connect/roomlist_search.rs | 3 +-
fractal-gtk/src/app/connect/send.rs | 5 ++-
fractal-gtk/src/app/mod.rs | 12 +++---
fractal-gtk/src/appop/about.rs | 6 +--
fractal-gtk/src/appop/account.rs | 16 ++++----
fractal-gtk/src/appop/attach.rs | 9 +++--
fractal-gtk/src/appop/directory.rs | 10 ++---
fractal-gtk/src/appop/invite.rs | 18 ++++-----
fractal-gtk/src/appop/login.rs | 23 +++++------
fractal-gtk/src/appop/media_viewer.rs | 8 ++--
fractal-gtk/src/appop/member.rs | 15 ++++----
fractal-gtk/src/appop/message.rs | 18 +++++----
fractal-gtk/src/appop/mod.rs | 22 +++++------
fractal-gtk/src/appop/notifications.rs | 2 +-
fractal-gtk/src/appop/notify.rs | 8 ++--
fractal-gtk/src/appop/room.rs | 21 +++++-----
fractal-gtk/src/appop/room_settings.rs | 6 +--
fractal-gtk/src/appop/start_chat.rs | 10 ++---
fractal-gtk/src/appop/state.rs | 6 +--
fractal-gtk/src/appop/sync.rs | 6 +--
fractal-gtk/src/appop/user.rs | 10 ++---
fractal-gtk/src/cache/mod.rs | 11 +++---
fractal-gtk/src/cache/state.rs | 8 ++--
fractal-gtk/src/i18n.rs | 2 +-
fractal-gtk/src/main.rs | 53 +-------------------------
fractal-gtk/src/passwd.rs | 3 +-
fractal-gtk/src/uibuilder.rs | 2 +-
fractal-gtk/src/uitypes.rs | 4 +-
fractal-gtk/src/util.rs | 3 +-
fractal-gtk/src/widgets/address.rs | 4 +-
fractal-gtk/src/widgets/autocomplete.rs | 8 ++--
fractal-gtk/src/widgets/image.rs | 2 +-
fractal-gtk/src/widgets/inline_player.rs | 4 +-
fractal-gtk/src/widgets/media_viewer.rs | 13 ++++---
fractal-gtk/src/widgets/member.rs | 12 +++---
fractal-gtk/src/widgets/members_list.rs | 9 +++--
fractal-gtk/src/widgets/message.rs | 28 +++++++-------
fractal-gtk/src/widgets/message_menu.rs | 2 +-
fractal-gtk/src/widgets/room.rs | 14 +++----
fractal-gtk/src/widgets/room_history.rs | 16 ++++----
fractal-gtk/src/widgets/room_settings.rs | 19 ++++-----
fractal-gtk/src/widgets/roomlist.rs | 13 ++++---
fractal-gtk/src/widgets/roomrow.rs | 6 +--
fractal-matrix-api/Cargo.toml | 4 +-
fractal-matrix-api/src/backend/directory.rs | 19 ++++-----
fractal-matrix-api/src/backend/media.rs | 24 ++++++------
fractal-matrix-api/src/backend/mod.rs | 6 +--
fractal-matrix-api/src/backend/register.rs | 11 +++---
fractal-matrix-api/src/backend/room.rs | 36 ++++++++---------
fractal-matrix-api/src/backend/stickers.rs | 21 +++++-----
fractal-matrix-api/src/backend/sync.rs | 24 ++++++------
fractal-matrix-api/src/backend/types.rs | 20 +++++-----
fractal-matrix-api/src/backend/user.rs | 30 ++++++++-------
fractal-matrix-api/src/globals.rs | 1 +
fractal-matrix-api/src/lib.rs | 22 -----------
fractal-matrix-api/src/model/member.rs | 1 +
fractal-matrix-api/src/model/message.rs | 1 +
fractal-matrix-api/src/model/room.rs | 7 ++--
fractal-matrix-api/src/model/stickers.rs | 1 +
fractal-matrix-api/src/model/userinfo.rs | 2 +
fractal-matrix-api/src/types.rs | 20 +++++-----
fractal-matrix-api/src/util.rs | 14 ++++---
80 files changed, 404 insertions(+), 420 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index b85a9882..01b92914 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -466,7 +466,6 @@ dependencies = [
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"secret-service 0.4.0
(git+https://github.com/jhaye/secret-service-rs?rev=3c265527e43376fe8e00ddfa645a70813c35f449)",
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
"sourceview 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tree_magic 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -486,7 +485,6 @@ dependencies = [
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"tree_magic 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2022,6 +2020,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "serde"
version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
+]
[[package]]
name = "serde_derive"
diff --git a/fractal-gtk/Cargo.toml b/fractal-gtk/Cargo.toml
index 9c6578a8..651d0e3d 100644
--- a/fractal-gtk/Cargo.toml
+++ b/fractal-gtk/Cargo.toml
@@ -4,6 +4,7 @@ build = "build.rs"
name = "fractal-gtk"
version = "4.0.0"
workspace = "../"
+edition = "2018"
[dependencies]
failure = "0.1.3"
@@ -12,13 +13,12 @@ gdk-pixbuf = "0.5.0"
gdk-pixbuf-sys = "0.7.0"
gio = "0.5.1"
glib = "0.6.1"
-gstreamer = "0.12.2"
-gstreamer-player = "0.12.2"
+gst = { version = "0.12.2", package = "gstreamer" }
+gst_player = { version = "0.12.2", package = "gstreamer-player" }
pango = "0.5.0"
pangocairo = "0.6.0"
secret-service = "0.4.0"
-serde = "1.0.82"
-serde_derive = "1.0.82"
+serde = { version = "1.0.82", features = ["derive"] }
serde_json = "1.0.33"
url = "1.7.2"
rand = "0.6.1"
@@ -44,8 +44,9 @@ version = "0.5.0"
features = ["serde"]
version = "0.4.6"
-[dependencies.fractal-matrix-api]
+[dependencies.fractal_api]
path = "../fractal-matrix-api"
+package = "fractal-matrix-api"
[dependencies.libhandy]
git = "https://gitlab.gnome.org/jsparber/libhandy-rs"
diff --git a/fractal-gtk/src/actions/global.rs b/fractal-gtk/src/actions/global.rs
index 87c3cc80..3236fb91 100644
--- a/fractal-gtk/src/actions/global.rs
+++ b/fractal-gtk/src/actions/global.rs
@@ -1,14 +1,16 @@
+use fractal_api::clone;
+use log::{debug, info};
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
-use appop::AppOp;
+use crate::appop::AppOp;
+use crate::App;
use fractal_api::types::Message;
use gio::prelude::*;
use gio::SimpleAction;
use glib;
use gtk::prelude::*;
-use App;
#[derive(Debug, Clone, PartialEq)]
pub enum AppState {
diff --git a/fractal-gtk/src/actions/room_history.rs b/fractal-gtk/src/actions/room_history.rs
index aa828c35..255115af 100644
--- a/fractal-gtk/src/actions/room_history.rs
+++ b/fractal-gtk/src/actions/room_history.rs
@@ -1,9 +1,14 @@
+use fractal_api::clone;
use std::fs;
use std::sync::mpsc::channel;
use std::sync::mpsc::TryRecvError;
use std::sync::mpsc::{Receiver, Sender};
-use backend::BKCommand;
+use crate::backend::BKCommand;
+use crate::i18n::i18n;
+use crate::types::Message;
+use crate::uibuilder::UI;
+use crate::App;
use gio::ActionMapExt;
use gio::SimpleAction;
use gio::SimpleActionExt;
@@ -11,13 +16,9 @@ use gio::SimpleActionGroup;
use gtk;
use gtk::prelude::*;
use gtk::ResponseType;
-use i18n::i18n;
-use types::Message;
-use uibuilder::UI;
-use App;
-use widgets::ErrorDialog;
-use widgets::SourceDialog;
+use crate::widgets::ErrorDialog;
+use crate::widgets::SourceDialog;
/* This creates all actions the room history can perform */
pub fn new(backend: Sender<BKCommand>, ui: UI) -> gio::SimpleActionGroup {
diff --git a/fractal-gtk/src/app/backend_loop.rs b/fractal-gtk/src/app/backend_loop.rs
index 739ec472..0cf4b672 100644
--- a/fractal-gtk/src/app/backend_loop.rs
+++ b/fractal-gtk/src/app/backend_loop.rs
@@ -1,15 +1,16 @@
-use app::App;
-use i18n::i18n;
+use crate::app::App;
+use crate::i18n::i18n;
+use log::{error, info};
-use actions::AppState;
-use appop::RoomPanel;
+use crate::actions::AppState;
+use crate::appop::RoomPanel;
use glib;
use std::process::Command;
use std::sync::mpsc::Receiver;
use std::thread;
-use backend::BKResponse;
+use crate::backend::BKResponse;
use fractal_api::error::Error;
use std::sync::mpsc::RecvError;
diff --git a/fractal-gtk/src/app/connect/account.rs b/fractal-gtk/src/app/connect/account.rs
index f94bfa6a..087ded11 100644
--- a/fractal-gtk/src/app/connect/account.rs
+++ b/fractal-gtk/src/app/connect/account.rs
@@ -1,10 +1,11 @@
+use fractal_api::clone;
use gtk;
use gtk::prelude::*;
use glib;
-use app::App;
-use i18n::i18n;
+use crate::app::App;
+use crate::i18n::i18n;
impl App {
pub fn connect_account_settings(&self) {
diff --git a/fractal-gtk/src/app/connect/attach.rs b/fractal-gtk/src/app/connect/attach.rs
index 005083ec..51c85f7e 100644
--- a/fractal-gtk/src/app/connect/attach.rs
+++ b/fractal-gtk/src/app/connect/attach.rs
@@ -1,6 +1,6 @@
use gtk::prelude::*;
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_attach(&self) {
diff --git a/fractal-gtk/src/app/connect/autocomplete.rs b/fractal-gtk/src/app/connect/autocomplete.rs
index aba47246..c31ddd2f 100644
--- a/fractal-gtk/src/app/connect/autocomplete.rs
+++ b/fractal-gtk/src/app/connect/autocomplete.rs
@@ -1,8 +1,8 @@
use gtk;
-use widgets;
+use crate::widgets;
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_autocomplete(&self) {
diff --git a/fractal-gtk/src/app/connect/direct.rs b/fractal-gtk/src/app/connect/direct.rs
index 6bb18781..2e59d916 100644
--- a/fractal-gtk/src/app/connect/direct.rs
+++ b/fractal-gtk/src/app/connect/direct.rs
@@ -1,3 +1,4 @@
+use fractal_api::clone;
use gdk;
use gtk;
use gtk::prelude::*;
@@ -5,7 +6,7 @@ use gtk::prelude::*;
use glib;
use std::sync::{Arc, Mutex};
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_direct_chat(&self) {
diff --git a/fractal-gtk/src/app/connect/directory.rs b/fractal-gtk/src/app/connect/directory.rs
index 28e1afda..f7da1124 100644
--- a/fractal-gtk/src/app/connect/directory.rs
+++ b/fractal-gtk/src/app/connect/directory.rs
@@ -1,11 +1,12 @@
+use fractal_api::clone;
use gtk;
-use i18n::i18n;
+use crate::i18n::i18n;
use gtk::prelude::*;
use libhandy::{Column, ColumnExt};
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_directory(&self) {
diff --git a/fractal-gtk/src/app/connect/headerbar.rs b/fractal-gtk/src/app/connect/headerbar.rs
index b143200e..dc815e47 100644
--- a/fractal-gtk/src/app/connect/headerbar.rs
+++ b/fractal-gtk/src/app/connect/headerbar.rs
@@ -1,7 +1,8 @@
+use fractal_api::clone;
use gtk;
use gtk::prelude::*;
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_headerbars(&self) {
diff --git a/fractal-gtk/src/app/connect/invite.rs b/fractal-gtk/src/app/connect/invite.rs
index 9eb7b000..7227e861 100644
--- a/fractal-gtk/src/app/connect/invite.rs
+++ b/fractal-gtk/src/app/connect/invite.rs
@@ -1,3 +1,4 @@
+use fractal_api::clone;
use gdk;
use gtk;
use gtk::prelude::*;
@@ -5,7 +6,7 @@ use gtk::prelude::*;
use glib;
use std::sync::{Arc, Mutex};
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_invite_dialog(&self) {
diff --git a/fractal-gtk/src/app/connect/join_room.rs b/fractal-gtk/src/app/connect/join_room.rs
index 56e7b931..80f2e9d3 100644
--- a/fractal-gtk/src/app/connect/join_room.rs
+++ b/fractal-gtk/src/app/connect/join_room.rs
@@ -1,9 +1,10 @@
+use fractal_api::clone;
use gtk;
use gtk::prelude::*;
use glib;
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_join_room_dialog(&self) {
diff --git a/fractal-gtk/src/app/connect/leave_room.rs b/fractal-gtk/src/app/connect/leave_room.rs
index 1d54399b..6a639091 100644
--- a/fractal-gtk/src/app/connect/leave_room.rs
+++ b/fractal-gtk/src/app/connect/leave_room.rs
@@ -1,9 +1,10 @@
+use fractal_api::clone;
use gtk;
use gtk::prelude::*;
use glib;
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_leave_room_dialog(&self) {
diff --git a/fractal-gtk/src/app/connect/login.rs b/fractal-gtk/src/app/connect/login.rs
index 1968761c..5d2457fa 100644
--- a/fractal-gtk/src/app/connect/login.rs
+++ b/fractal-gtk/src/app/connect/login.rs
@@ -1,7 +1,7 @@
use gtk;
use gtk::prelude::*;
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_login_view(&self) {
diff --git a/fractal-gtk/src/app/connect/markdown.rs b/fractal-gtk/src/app/connect/markdown.rs
index 6f4e9217..0752371d 100644
--- a/fractal-gtk/src/app/connect/markdown.rs
+++ b/fractal-gtk/src/app/connect/markdown.rs
@@ -3,9 +3,9 @@ use gtk::prelude::*;
use sourceview;
use sourceview::prelude::*;
-use util;
+use crate::util;
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_markdown(&self) {
diff --git a/fractal-gtk/src/app/connect/mod.rs b/fractal-gtk/src/app/connect/mod.rs
index ccac0a12..fcea064f 100644
--- a/fractal-gtk/src/app/connect/mod.rs
+++ b/fractal-gtk/src/app/connect/mod.rs
@@ -13,7 +13,7 @@ mod new_room;
mod roomlist_search;
mod send;
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_gtk(&self) {
diff --git a/fractal-gtk/src/app/connect/new_room.rs b/fractal-gtk/src/app/connect/new_room.rs
index 939f1e28..938507e8 100644
--- a/fractal-gtk/src/app/connect/new_room.rs
+++ b/fractal-gtk/src/app/connect/new_room.rs
@@ -1,9 +1,10 @@
+use fractal_api::clone;
use gtk;
use gtk::prelude::*;
use glib;
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_new_room_dialog(&self) {
diff --git a/fractal-gtk/src/app/connect/roomlist_search.rs b/fractal-gtk/src/app/connect/roomlist_search.rs
index 06f530f4..d9480d2c 100644
--- a/fractal-gtk/src/app/connect/roomlist_search.rs
+++ b/fractal-gtk/src/app/connect/roomlist_search.rs
@@ -1,7 +1,8 @@
+use fractal_api::clone;
use gtk;
use gtk::prelude::*;
-use app::App;
+use crate::app::App;
impl App {
pub fn connect_roomlist_search(&self) {
diff --git a/fractal-gtk/src/app/connect/send.rs b/fractal-gtk/src/app/connect/send.rs
index dd377d9e..299cf61f 100644
--- a/fractal-gtk/src/app/connect/send.rs
+++ b/fractal-gtk/src/app/connect/send.rs
@@ -1,10 +1,11 @@
-use appop::attach;
+use crate::appop::attach;
+use fractal_api::clone;
use gdk;
use gtk;
use gtk::prelude::*;
use sourceview::BufferExt;
-use app::App;
+use crate::app::App;
const MAX_INPUT_HEIGHT: i32 = 100;
diff --git a/fractal-gtk/src/app/mod.rs b/fractal-gtk/src/app/mod.rs
index dbc58761..ea0ae9e2 100644
--- a/fractal-gtk/src/app/mod.rs
+++ b/fractal-gtk/src/app/mod.rs
@@ -9,13 +9,13 @@ use std::sync::mpsc::channel;
use std::sync::mpsc::{Receiver, Sender};
use std::sync::{Arc, Mutex, Weak as SyncWeak};
-use appop::AppOp;
-use backend::BKResponse;
-use backend::Backend;
+use crate::appop::AppOp;
+use crate::backend::BKResponse;
+use crate::backend::Backend;
-use actions;
-use globals;
-use uibuilder;
+use crate::actions;
+use crate::globals;
+use crate::uibuilder;
mod connect;
diff --git a/fractal-gtk/src/appop/about.rs b/fractal-gtk/src/appop/about.rs
index 926ba6b4..fb494f6f 100644
--- a/fractal-gtk/src/appop/about.rs
+++ b/fractal-gtk/src/appop/about.rs
@@ -1,10 +1,10 @@
-use i18n::i18n;
+use crate::i18n::i18n;
use gtk;
use gtk::prelude::*;
-use appop::AppOp;
-use globals;
+use crate::appop::AppOp;
+use crate::globals;
impl AppOp {
pub fn about_dialog(&self) {
diff --git a/fractal-gtk/src/appop/account.rs b/fractal-gtk/src/appop/account.rs
index 7a45f112..04a16b5d 100644
--- a/fractal-gtk/src/appop/account.rs
+++ b/fractal-gtk/src/appop/account.rs
@@ -1,15 +1,17 @@
+use fractal_api::clone;
use gtk;
use gtk::prelude::*;
+use log::info;
-use appop::AppOp;
-use appop::AppState;
+use crate::appop::AppOp;
+use crate::appop::AppState;
-use backend::BKCommand;
-use i18n::i18n;
-use widgets;
-use widgets::AvatarExt;
+use crate::backend::BKCommand;
+use crate::i18n::i18n;
+use crate::widgets;
+use crate::widgets::AvatarExt;
-use cache::download_to_cache;
+use crate::cache::download_to_cache;
use fractal_api::types::UserInfo;
impl AppOp {
diff --git a/fractal-gtk/src/appop/attach.rs b/fractal-gtk/src/appop/attach.rs
index 4d0da6ef..b5c44279 100644
--- a/fractal-gtk/src/appop/attach.rs
+++ b/fractal-gtk/src/appop/attach.rs
@@ -1,4 +1,5 @@
-use i18n::i18n;
+use crate::i18n::i18n;
+use fractal_api::clone;
use std::fs::File;
use std::io::prelude::*;
@@ -13,13 +14,13 @@ use glib;
use gtk;
use gtk::prelude::*;
-use appop::AppOp;
-use App;
+use crate::appop::AppOp;
+use crate::App;
+use crate::util::get_pixbuf_data;
use gdk_pixbuf;
use gdk_pixbuf::Pixbuf;
use gdk_pixbuf::PixbufExt;
-use util::get_pixbuf_data;
impl AppOp {
fn draw_image_paste_dialog(&self, pixb: &Pixbuf) {
diff --git a/fractal-gtk/src/appop/directory.rs b/fractal-gtk/src/appop/directory.rs
index 4575f36f..d2f14965 100644
--- a/fractal-gtk/src/appop/directory.rs
+++ b/fractal-gtk/src/appop/directory.rs
@@ -2,13 +2,13 @@ use gtk;
use gtk::prelude::*;
use libhandy::Column;
-use appop::AppOp;
+use crate::appop::AppOp;
-use backend::BKCommand;
-use widgets;
+use crate::backend::BKCommand;
+use crate::widgets;
-use types::Protocol;
-use types::Room;
+use crate::types::Protocol;
+use crate::types::Room;
impl AppOp {
pub fn init_protocols(&self) {
diff --git a/fractal-gtk/src/appop/invite.rs b/fractal-gtk/src/appop/invite.rs
index 524bc941..7b666661 100644
--- a/fractal-gtk/src/appop/invite.rs
+++ b/fractal-gtk/src/appop/invite.rs
@@ -1,18 +1,18 @@
-use i18n::{i18n, i18n_k};
+use crate::i18n::{i18n, i18n_k};
use gtk;
use gtk::prelude::*;
-use appop::member::SearchType;
-use appop::AppOp;
+use crate::appop::member::SearchType;
+use crate::appop::AppOp;
-use backend::BKCommand;
+use crate::backend::BKCommand;
-use globals;
+use crate::globals;
-use widgets;
+use crate::widgets;
-use types::Member;
+use crate::types::Member;
impl AppOp {
pub fn add_to_invite(&mut self, u: Member) {
@@ -298,8 +298,8 @@ impl AppOp {
.expect("Can't find invite_entry in ui file.");
if let Some(buffer) = invite_entry.get_buffer() {
- let mut start = buffer.get_start_iter();
- let mut end = buffer.get_end_iter();
+ let start = buffer.get_start_iter();
+ let end = buffer.get_end_iter();
if let Some(text) = buffer.get_text(&start, &end, true) {
if text == globals::PLACEHOLDER_TEXT && self.invite_list.is_empty() {
diff --git a/fractal-gtk/src/appop/login.rs b/fractal-gtk/src/appop/login.rs
index e832daf1..08122cfb 100644
--- a/fractal-gtk/src/appop/login.rs
+++ b/fractal-gtk/src/appop/login.rs
@@ -1,25 +1,26 @@
-use i18n::i18n;
+use crate::i18n::i18n;
+use log::error;
-use globals;
+use crate::globals;
use gtk;
use gtk::prelude::*;
-use appop::AppOp;
+use crate::appop::AppOp;
-use backend::BKCommand;
-use backend::BKResponse;
-use backend::Backend;
-use cache;
+use crate::backend::BKCommand;
+use crate::backend::BKResponse;
+use crate::backend::Backend;
+use crate::cache;
use std::sync::mpsc::channel;
use std::sync::mpsc::{Receiver, Sender};
-use app::backend_loop;
+use crate::app::backend_loop;
-use passwd::PasswordStorage;
+use crate::passwd::PasswordStorage;
-use actions::AppState;
-use widgets::ErrorDialog;
+use crate::actions::AppState;
+use crate::widgets::ErrorDialog;
impl AppOp {
pub fn bk_login(&mut self, uid: String, token: String, device: Option<String>) {
diff --git a/fractal-gtk/src/appop/media_viewer.rs b/fractal-gtk/src/appop/media_viewer.rs
index 0bdcd211..5e63a609 100644
--- a/fractal-gtk/src/appop/media_viewer.rs
+++ b/fractal-gtk/src/appop/media_viewer.rs
@@ -1,12 +1,12 @@
use gtk;
use gtk::prelude::*;
-use appop::AppOp;
-use appop::AppState;
+use crate::appop::AppOp;
+use crate::appop::AppState;
-use widgets;
+use crate::widgets;
-use types::Message;
+use crate::types::Message;
impl AppOp {
/* FIXME: take msg by reference and maybe create an action for this */
diff --git a/fractal-gtk/src/appop/member.rs b/fractal-gtk/src/appop/member.rs
index d08c6cad..f96a5af0 100644
--- a/fractal-gtk/src/appop/member.rs
+++ b/fractal-gtk/src/appop/member.rs
@@ -1,17 +1,18 @@
+use fractal_api::clone;
use gtk;
use gtk::prelude::*;
use std::collections::HashMap;
-use actions::AppState;
-use appop::AppOp;
-use backend::BKCommand;
+use crate::actions::AppState;
+use crate::appop::AppOp;
+use crate::backend::BKCommand;
+use crate::widgets;
+use crate::App;
use glib;
-use widgets;
-use App;
-use types::Event;
-use types::Member;
+use crate::types::Event;
+use crate::types::Member;
#[derive(Debug, Clone)]
pub enum SearchType {
diff --git a/fractal-gtk/src/appop/message.rs b/fractal-gtk/src/appop/message.rs
index c8d95765..948b8429 100644
--- a/fractal-gtk/src/appop/message.rs
+++ b/fractal-gtk/src/appop/message.rs
@@ -2,23 +2,25 @@ use chrono::prelude::*;
use comrak::{markdown_to_html, ComrakOptions};
use gtk;
use gtk::prelude::*;
+use lazy_static::lazy_static;
use std::collections::HashMap;
use std::fs;
use std::path::Path;
use tree_magic;
-use appop::room::Force;
-use appop::AppOp;
-use App;
+use crate::appop::room::Force;
+use crate::appop::AppOp;
+use crate::App;
-use backend::BKCommand;
-use uitypes::MessageContent;
-use uitypes::RowType;
-use widgets;
+use crate::backend::BKCommand;
+use crate::uitypes::MessageContent;
+use crate::uitypes::RowType;
+use crate::widgets;
+use crate::types::Message;
use gdk_pixbuf::Pixbuf;
+use serde_json::json;
use serde_json::Value as JsonValue;
-use types::Message;
pub struct TmpMsg {
pub msg: Message,
diff --git a/fractal-gtk/src/appop/mod.rs b/fractal-gtk/src/appop/mod.rs
index 0fa265a6..d87f6d13 100644
--- a/fractal-gtk/src/appop/mod.rs
+++ b/fractal-gtk/src/appop/mod.rs
@@ -4,20 +4,20 @@ use std::sync::mpsc::Sender;
use gtk;
use gtk::prelude::*;
-use backend;
-use backend::BKCommand;
-use globals;
+use crate::backend;
+use crate::backend::BKCommand;
+use crate::globals;
-use types::Member;
-use types::Room;
-use types::RoomList;
+use crate::types::Member;
+use crate::types::Room;
+use crate::types::RoomList;
-use passwd::PasswordStorage;
+use crate::passwd::PasswordStorage;
-use actions::AppState;
-use cache;
-use uibuilder;
-use widgets;
+use crate::actions::AppState;
+use crate::cache;
+use crate::uibuilder;
+use crate::widgets;
mod about;
mod account;
diff --git a/fractal-gtk/src/appop/notifications.rs b/fractal-gtk/src/appop/notifications.rs
index b3cd6453..feb5d307 100644
--- a/fractal-gtk/src/appop/notifications.rs
+++ b/fractal-gtk/src/appop/notifications.rs
@@ -1,4 +1,4 @@
-use appop::AppOp;
+use crate::appop::AppOp;
impl AppOp {
pub fn clear_room_notifications(&mut self, r: String) {
diff --git a/fractal-gtk/src/appop/notify.rs b/fractal-gtk/src/appop/notify.rs
index 691df848..4fe495c0 100644
--- a/fractal-gtk/src/appop/notify.rs
+++ b/fractal-gtk/src/appop/notify.rs
@@ -7,12 +7,12 @@ use std::sync::mpsc::channel;
use std::sync::mpsc::TryRecvError;
use std::sync::mpsc::{Receiver, Sender};
-use i18n::i18n;
+use crate::i18n::i18n;
-use appop::AppOp;
-use backend::BKCommand;
+use crate::appop::AppOp;
+use crate::backend::BKCommand;
-use widgets::ErrorDialog;
+use crate::widgets::ErrorDialog;
impl AppOp {
pub fn inapp_notify(&self, msg: &str) {
diff --git a/fractal-gtk/src/appop/room.rs b/fractal-gtk/src/appop/room.rs
index 7399db13..87e0186d 100644
--- a/fractal-gtk/src/appop/room.rs
+++ b/fractal-gtk/src/appop/room.rs
@@ -1,21 +1,22 @@
-use i18n::{i18n, i18n_k};
+use crate::i18n::{i18n, i18n_k};
+use log::{error, warn};
use gtk;
use gtk::prelude::*;
-use appop::AppOp;
+use crate::appop::AppOp;
-use backend;
-use backend::BKCommand;
+use crate::backend;
+use crate::backend::BKCommand;
-use actions;
-use actions::AppState;
-use cache;
-use widgets;
+use crate::actions;
+use crate::actions::AppState;
+use crate::cache;
+use crate::widgets;
-use types::Room;
+use crate::types::Room;
-use util::markup_text;
+use crate::util::markup_text;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
diff --git a/fractal-gtk/src/appop/room_settings.rs b/fractal-gtk/src/appop/room_settings.rs
index 54d89684..9505aae3 100644
--- a/fractal-gtk/src/appop/room_settings.rs
+++ b/fractal-gtk/src/appop/room_settings.rs
@@ -1,10 +1,10 @@
use gtk;
use gtk::prelude::*;
-use actions::AppState;
-use appop::AppOp;
+use crate::actions::AppState;
+use crate::appop::AppOp;
-use widgets;
+use crate::widgets;
impl AppOp {
pub fn create_room_settings(&mut self) -> Option<()> {
diff --git a/fractal-gtk/src/appop/start_chat.rs b/fractal-gtk/src/appop/start_chat.rs
index cb08822b..465f6c59 100644
--- a/fractal-gtk/src/appop/start_chat.rs
+++ b/fractal-gtk/src/appop/start_chat.rs
@@ -1,12 +1,12 @@
use gtk;
use gtk::prelude::*;
-use appop::AppOp;
-use appop::RoomPanel;
-use appop::SearchType;
+use crate::appop::AppOp;
+use crate::appop::RoomPanel;
+use crate::appop::SearchType;
-use backend::BKCommand;
-use types::Room;
+use crate::backend::BKCommand;
+use crate::types::Room;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
diff --git a/fractal-gtk/src/appop/state.rs b/fractal-gtk/src/appop/state.rs
index 0f850ebe..7cd6b433 100644
--- a/fractal-gtk/src/appop/state.rs
+++ b/fractal-gtk/src/appop/state.rs
@@ -1,9 +1,9 @@
use gtk;
use gtk::prelude::*;
-use actions::AppState;
-use appop::room::RoomPanel;
-use appop::AppOp;
+use crate::actions::AppState;
+use crate::appop::room::RoomPanel;
+use crate::appop::AppOp;
impl AppOp {
pub fn set_state(&mut self, state: AppState) {
diff --git a/fractal-gtk/src/appop/sync.rs b/fractal-gtk/src/appop/sync.rs
index f8cef49b..5cc85862 100644
--- a/fractal-gtk/src/appop/sync.rs
+++ b/fractal-gtk/src/appop/sync.rs
@@ -1,8 +1,8 @@
-use i18n::i18n;
+use crate::i18n::i18n;
-use appop::AppOp;
+use crate::appop::AppOp;
-use backend::BKCommand;
+use crate::backend::BKCommand;
impl AppOp {
pub fn initial_sync(&self, show: bool) {
diff --git a/fractal-gtk/src/appop/user.rs b/fractal-gtk/src/appop/user.rs
index afe22db6..88306a2d 100644
--- a/fractal-gtk/src/appop/user.rs
+++ b/fractal-gtk/src/appop/user.rs
@@ -1,13 +1,13 @@
use gtk;
use gtk::prelude::*;
-use appop::AppOp;
+use crate::appop::AppOp;
-use cache::download_to_cache;
+use crate::cache::download_to_cache;
-use backend::BKCommand;
-use widgets;
-use widgets::AvatarExt;
+use crate::backend::BKCommand;
+use crate::widgets;
+use crate::widgets::AvatarExt;
impl AppOp {
pub fn get_username(&self) {
diff --git a/fractal-gtk/src/cache/mod.rs b/fractal-gtk/src/cache/mod.rs
index 483f4874..b7a90f66 100644
--- a/fractal-gtk/src/cache/mod.rs
+++ b/fractal-gtk/src/cache/mod.rs
@@ -1,26 +1,27 @@
use gtk;
use gtk::LabelExt;
+use serde::{Deserialize, Serialize};
use std::fs::remove_dir_all;
+use crate::types::Room;
+use crate::types::RoomList;
use failure::err_msg;
use failure::Error;
use std::collections::HashMap;
-use types::Room;
-use types::RoomList;
+use crate::globals;
use fractal_api::util::cache_path;
-use globals;
/* includes for avatar download */
-use backend::BKCommand;
+use crate::backend::BKCommand;
use std::sync::mpsc::channel;
use std::sync::mpsc::Receiver;
use std::sync::mpsc::Sender;
use std::sync::mpsc::TryRecvError;
+use crate::widgets::AvatarData;
use std::cell::RefCell;
use std::rc::Rc;
-use widgets::AvatarData;
mod state;
pub use self::state::get;
diff --git a/fractal-gtk/src/cache/state.rs b/fractal-gtk/src/cache/state.rs
index bf082f4a..daf1314b 100644
--- a/fractal-gtk/src/cache/state.rs
+++ b/fractal-gtk/src/cache/state.rs
@@ -1,15 +1,17 @@
+use lazy_static::lazy_static;
use mdl::Cache;
use mdl::Model;
use mdl::Store;
+use serde::{Deserialize, Serialize};
use failure::Error;
use std::cell::RefCell;
use std::sync::{Arc, Mutex, MutexGuard};
+use crate::types::Message;
+use crate::types::Room;
use fractal_api::util::cache_path;
-use types::Message;
-use types::Room;
// Models
@@ -97,7 +99,7 @@ pub struct FCache {
}
impl FCache {
- pub fn get_store(&self) -> MutexGuard<Cache> {
+ pub fn get_store(&self) -> MutexGuard<'_, Cache> {
self.cache.lock().unwrap()
}
diff --git a/fractal-gtk/src/i18n.rs b/fractal-gtk/src/i18n.rs
index 2fd81bd5..8a9ce52a 100644
--- a/fractal-gtk/src/i18n.rs
+++ b/fractal-gtk/src/i18n.rs
@@ -21,7 +21,7 @@ fn kreplace(input: String, kwargs: &[(&str, &str)]) -> String {
for (k, v) in kwargs {
if let Ok(re) = Regex::new(&format!("\\{{{}\\}}", k)) {
s = re
- .replace_all(&s, |_: &Captures| v.to_string().clone())
+ .replace_all(&s, |_: &Captures<'_>| v.to_string().clone())
.to_string();
}
}
diff --git a/fractal-gtk/src/main.rs b/fractal-gtk/src/main.rs
index c4f49455..b352f8af 100644
--- a/fractal-gtk/src/main.rs
+++ b/fractal-gtk/src/main.rs
@@ -1,54 +1,3 @@
-#![deny(unused_extern_crates)]
-extern crate gdk;
-extern crate gio;
-extern crate glib;
-extern crate gtk;
-extern crate sourceview;
-
-extern crate dirs;
-extern crate gdk_pixbuf;
-extern crate itertools;
-extern crate rand;
-extern crate regex;
-
-extern crate gstreamer as gst;
-extern crate gstreamer_player as gst_player;
-
-#[macro_use]
-extern crate log;
-
-#[macro_use]
-extern crate failure;
-
-#[macro_use]
-extern crate serde_derive;
-#[macro_use]
-extern crate serde_json;
-
-#[macro_use]
-extern crate fractal_matrix_api as fractal_api;
-
-extern crate html2pango;
-
-extern crate libhandy;
-
-extern crate gettextrs;
-
-extern crate cairo;
-extern crate chrono;
-extern crate comrak;
-extern crate letter_avatar;
-extern crate pango;
-extern crate secret_service;
-extern crate tree_magic;
-extern crate url;
-
-extern crate fragile;
-
-extern crate mdl;
-#[macro_use]
-extern crate lazy_static;
-
use fractal_api::backend;
use fractal_api::error;
use fractal_api::types;
@@ -72,7 +21,7 @@ mod appop;
use std::env::args;
use std::error::Error;
-use app::App;
+use crate::app::App;
use gio::ApplicationExt;
use gio::ApplicationExtManual;
diff --git a/fractal-gtk/src/passwd.rs b/fractal-gtk/src/passwd.rs
index 89f4ac8a..ab4b856b 100644
--- a/fractal-gtk/src/passwd.rs
+++ b/fractal-gtk/src/passwd.rs
@@ -1,3 +1,4 @@
+use fractal_api::derror;
use secret_service;
#[derive(Debug)]
@@ -41,7 +42,7 @@ mod ss_storage {
use super::secret_service::EncryptionType;
use super::secret_service::SecretService;
- use globals;
+ use crate::globals;
pub fn delete_pass(key: &str) -> Result<(), Error> {
let ss = SecretService::new(EncryptionType::Dh)?;
diff --git a/fractal-gtk/src/uibuilder.rs b/fractal-gtk/src/uibuilder.rs
index db75117d..e4720e21 100644
--- a/fractal-gtk/src/uibuilder.rs
+++ b/fractal-gtk/src/uibuilder.rs
@@ -1,5 +1,5 @@
+use crate::widgets::SVEntry;
use gtk::{self, prelude::*};
-use widgets::SVEntry;
#[derive(Clone, Debug)]
pub struct UI {
diff --git a/fractal-gtk/src/uitypes.rs b/fractal-gtk/src/uitypes.rs
index 263001c6..f3078af3 100644
--- a/fractal-gtk/src/uitypes.rs
+++ b/fractal-gtk/src/uitypes.rs
@@ -1,7 +1,7 @@
+use crate::types::Message;
+use crate::widgets;
use chrono::prelude::DateTime;
use chrono::prelude::Local;
-use types::Message;
-use widgets;
/* MessageContent contains all data needed to display one row
* therefore it should contain only one Message body with one format
* To-Do: this should be moved to a file collecting all structs used in the UI */
diff --git a/fractal-gtk/src/util.rs b/fractal-gtk/src/util.rs
index eaf31bc7..3ca928f7 100644
--- a/fractal-gtk/src/util.rs
+++ b/fractal-gtk/src/util.rs
@@ -1,4 +1,5 @@
use cairo;
+use failure::format_err;
use failure::Error;
use gdk::ContextExt;
use gdk_pixbuf::Pixbuf;
@@ -8,7 +9,7 @@ use gio::{Settings, SettingsExt, SettingsSchemaSource};
use html2pango::{html_escape, markup_links};
pub mod glib_thread_prelude {
- pub use error::Error;
+ pub use crate::error::Error;
pub use std::sync::mpsc::channel;
pub use std::sync::mpsc::TryRecvError;
pub use std::sync::mpsc::{Receiver, Sender};
diff --git a/fractal-gtk/src/widgets/address.rs b/fractal-gtk/src/widgets/address.rs
index f9b31d0a..3a9d9228 100644
--- a/fractal-gtk/src/widgets/address.rs
+++ b/fractal-gtk/src/widgets/address.rs
@@ -5,8 +5,8 @@ use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use std::sync::mpsc::Sender;
-use appop::AppOp;
-use backend::BKCommand;
+use crate::appop::AppOp;
+use crate::backend::BKCommand;
#[derive(Debug, Clone)]
pub enum AddressType {
diff --git a/fractal-gtk/src/widgets/autocomplete.rs b/fractal-gtk/src/widgets/autocomplete.rs
index ad6979ab..863ea55a 100644
--- a/fractal-gtk/src/widgets/autocomplete.rs
+++ b/fractal-gtk/src/widgets/autocomplete.rs
@@ -1,3 +1,5 @@
+use fractal_api::clone;
+use log::info;
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
@@ -10,10 +12,10 @@ use gtk::prelude::*;
use gtk::TextTag;
use sourceview;
-use types::Member;
+use crate::types::Member;
-use appop::AppOp;
-use widgets;
+use crate::appop::AppOp;
+use crate::widgets;
pub struct Autocomplete {
entry: sourceview::View,
diff --git a/fractal-gtk/src/widgets/image.rs b/fractal-gtk/src/widgets/image.rs
index 4a8e569a..3ca01272 100644
--- a/fractal-gtk/src/widgets/image.rs
+++ b/fractal-gtk/src/widgets/image.rs
@@ -14,7 +14,7 @@ use std::sync::mpsc::{Receiver, Sender};
use std::sync::{Arc, Mutex};
use tree_magic;
-use backend::BKCommand;
+use crate::backend::BKCommand;
use std::sync::mpsc::TryRecvError;
#[derive(Clone, Debug)]
diff --git a/fractal-gtk/src/widgets/inline_player.rs b/fractal-gtk/src/widgets/inline_player.rs
index 3afd1048..ab1e7491 100644
--- a/fractal-gtk/src/widgets/inline_player.rs
+++ b/fractal-gtk/src/widgets/inline_player.rs
@@ -17,9 +17,11 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later
+use fractal_api::clone;
use gst::prelude::*;
use gst::ClockTime;
use gst_player;
+use log::{error, warn};
use gtk;
use gtk::prelude::*;
@@ -38,7 +40,7 @@ trait PlayerExt {
fn play(&self);
fn pause(&self);
fn stop(&self);
- fn set_uri(&self, &str);
+ fn set_uri(&self, uri: &str);
}
#[derive(Debug, Clone)]
diff --git a/fractal-gtk/src/widgets/media_viewer.rs b/fractal-gtk/src/widgets/media_viewer.rs
index 15250214..7183f1b5 100644
--- a/fractal-gtk/src/widgets/media_viewer.rs
+++ b/fractal-gtk/src/widgets/media_viewer.rs
@@ -1,8 +1,10 @@
+use fractal_api::clone;
use gdk;
use std::cell::RefCell;
use std::rc::Rc;
+use crate::i18n::i18n;
use dirs;
use gdk::*;
use glib;
@@ -10,21 +12,20 @@ use glib::signal;
use gtk;
use gtk::prelude::*;
use gtk::ResponseType;
-use i18n::i18n;
-use types::Message;
-use types::Room;
+use crate::types::Message;
+use crate::types::Room;
use std::fs;
-use backend::BKCommand;
+use crate::backend::BKCommand;
+use crate::widgets::image;
+use crate::widgets::ErrorDialog;
use std::sync::mpsc::channel;
use std::sync::mpsc::TryRecvError;
use std::sync::mpsc::{Receiver, Sender};
use std::sync::Arc;
use std::sync::Mutex;
-use widgets::image;
-use widgets::ErrorDialog;
const FLOATING_POINT_ERROR: f64 = 0.01;
const ZOOM_LEVELS: [f64; 7] = [0.025, 0.05, 0.1, 0.25, 0.5, 0.75, 1.0];
diff --git a/fractal-gtk/src/widgets/member.rs b/fractal-gtk/src/widgets/member.rs
index 611f12fd..c3447dc5 100644
--- a/fractal-gtk/src/widgets/member.rs
+++ b/fractal-gtk/src/widgets/member.rs
@@ -2,14 +2,14 @@ use gtk;
use gtk::prelude::*;
use pango;
-use types::Member;
+use crate::types::Member;
-use appop::AppOp;
+use crate::appop::AppOp;
-use cache::download_to_cache;
-use globals;
-use widgets;
-use widgets::AvatarExt;
+use crate::cache::download_to_cache;
+use crate::globals;
+use crate::widgets;
+use crate::widgets::AvatarExt;
// Room Search item
pub struct MemberBox<'a> {
diff --git a/fractal-gtk/src/widgets/members_list.rs b/fractal-gtk/src/widgets/members_list.rs
index 220f288a..dbc3b321 100644
--- a/fractal-gtk/src/widgets/members_list.rs
+++ b/fractal-gtk/src/widgets/members_list.rs
@@ -1,3 +1,4 @@
+use fractal_api::clone;
use std::cell::RefCell;
use std::rc::Rc;
@@ -5,10 +6,10 @@ use glib::signal;
use gtk;
use gtk::prelude::*;
-use i18n::i18n;
-use types::Member;
-use widgets;
-use widgets::avatar::AvatarExt;
+use crate::i18n::i18n;
+use crate::types::Member;
+use crate::widgets;
+use crate::widgets::avatar::AvatarExt;
#[derive(Debug, Clone)]
pub struct MembersList {
diff --git a/fractal-gtk/src/widgets/message.rs b/fractal-gtk/src/widgets/message.rs
index 098acac4..543d26d4 100644
--- a/fractal-gtk/src/widgets/message.rs
+++ b/fractal-gtk/src/widgets/message.rs
@@ -1,6 +1,8 @@
-use app::App;
-use i18n::i18n;
+use crate::app::App;
+use crate::i18n::i18n;
+use fractal_api::clone;
use itertools::Itertools;
+use log::info;
use chrono::prelude::*;
use glib;
@@ -8,24 +10,24 @@ use gtk;
use gtk::prelude::*;
use pango;
-use backend::BKCommand;
+use crate::backend::BKCommand;
-use util::markup_text;
+use crate::util::markup_text;
use std::sync::mpsc::channel;
use std::sync::mpsc::TryRecvError;
use std::sync::mpsc::{Receiver, Sender};
-use cache::download_to_cache;
-use cache::download_to_cache_username;
-use cache::download_to_cache_username_emote;
+use crate::cache::download_to_cache;
+use crate::cache::download_to_cache_username;
+use crate::cache::download_to_cache_username_emote;
-use globals;
-use uitypes::MessageContent as Message;
-use uitypes::RowType;
-use widgets;
-use widgets::message_menu::MessageMenu;
-use widgets::AvatarExt;
+use crate::globals;
+use crate::uitypes::MessageContent as Message;
+use crate::uitypes::RowType;
+use crate::widgets;
+use crate::widgets::message_menu::MessageMenu;
+use crate::widgets::AvatarExt;
/* A message row in the room history */
#[derive(Clone, Debug)]
diff --git a/fractal-gtk/src/widgets/message_menu.rs b/fractal-gtk/src/widgets/message_menu.rs
index 50b8cd2d..f062ee44 100644
--- a/fractal-gtk/src/widgets/message_menu.rs
+++ b/fractal-gtk/src/widgets/message_menu.rs
@@ -3,7 +3,7 @@ use gdk::prelude::*;
use gtk;
use gtk::prelude::*;
-use uitypes::RowType;
+use crate::uitypes::RowType;
#[derive(Clone)]
struct Widgets {
diff --git a/fractal-gtk/src/widgets/room.rs b/fractal-gtk/src/widgets/room.rs
index 705f7f27..f60866fb 100644
--- a/fractal-gtk/src/widgets/room.rs
+++ b/fractal-gtk/src/widgets/room.rs
@@ -1,20 +1,20 @@
-use i18n::i18n;
+use crate::i18n::i18n;
use gtk;
use gtk::prelude::*;
use pango;
-use types::Room;
+use crate::types::Room;
-use backend::BKCommand;
+use crate::backend::BKCommand;
-use util::markup_text;
+use crate::util::markup_text;
-use appop::AppOp;
+use crate::appop::AppOp;
+use crate::widgets;
+use crate::widgets::AvatarExt;
use gtk::WidgetExt;
-use widgets;
-use widgets::AvatarExt;
const AVATAR_SIZE: i32 = 60;
const JOIN_BUTTON_WIDTH: i32 = 84;
diff --git a/fractal-gtk/src/widgets/room_history.rs b/fractal-gtk/src/widgets/room_history.rs
index 1d9ce168..d98a4501 100644
--- a/fractal-gtk/src/widgets/room_history.rs
+++ b/fractal-gtk/src/widgets/room_history.rs
@@ -7,19 +7,19 @@ use std::collections::VecDeque;
use std::rc::Rc;
use std::sync::mpsc::Sender;
-use appop::AppOp;
-use backend::BKCommand;
-use i18n::i18n;
-use uitypes::MessageContent;
-use uitypes::RowType;
-
+use crate::appop::AppOp;
+use crate::backend::BKCommand;
+use crate::i18n::i18n;
+use crate::uitypes::MessageContent;
+use crate::uitypes::RowType;
+
+use crate::globals;
+use crate::widgets;
use gio::ActionMapExt;
use gio::SimpleActionGroup;
use glib::source;
-use globals;
use gtk;
use gtk::prelude::*;
-use widgets;
struct List {
list: VecDeque<Element>,
diff --git a/fractal-gtk/src/widgets/room_settings.rs b/fractal-gtk/src/widgets/room_settings.rs
index c363a817..07d525e9 100644
--- a/fractal-gtk/src/widgets/room_settings.rs
+++ b/fractal-gtk/src/widgets/room_settings.rs
@@ -1,20 +1,21 @@
+use fractal_api::clone;
use std::cell::RefCell;
use std::rc::Rc;
+use crate::i18n::i18n;
+use crate::i18n::ni18n_f;
use gtk;
use gtk::prelude::*;
-use i18n::i18n;
-use i18n::ni18n_f;
-use backend::BKCommand;
-use cache::download_to_cache;
+use crate::backend::BKCommand;
+use crate::cache::download_to_cache;
+use crate::types::Member;
+use crate::util::markup_text;
+use crate::widgets;
+use crate::widgets::avatar::AvatarExt;
+use crate::widgets::members_list::MembersList;
use fractal_api::types::Room;
use std::sync::mpsc::Sender;
-use types::Member;
-use util::markup_text;
-use widgets;
-use widgets::avatar::AvatarExt;
-use widgets::members_list::MembersList;
#[derive(Debug, Clone)]
pub struct RoomSettings {
diff --git a/fractal-gtk/src/widgets/roomlist.rs b/fractal-gtk/src/widgets/roomlist.rs
index 97560ef5..84497b80 100644
--- a/fractal-gtk/src/widgets/roomlist.rs
+++ b/fractal-gtk/src/widgets/roomlist.rs
@@ -1,4 +1,5 @@
-use i18n::i18n;
+use crate::i18n::i18n;
+use fractal_api::clone;
use gdk;
use gdk::DragContextExtManual;
@@ -10,11 +11,11 @@ use gtk::prelude::*;
use std::collections::HashMap;
use url::Url;
-use globals;
+use crate::globals;
+use crate::types::Message;
+use crate::types::Room;
+use crate::widgets::roomrow::RoomRow;
use std::sync::{Arc, Mutex, MutexGuard};
-use types::Message;
-use types::Room;
-use widgets::roomrow::RoomRow;
use chrono::prelude::*;
@@ -388,7 +389,7 @@ impl RGroup {
}
}
- pub fn get(&self) -> MutexGuard<RoomListGroup> {
+ pub fn get(&self) -> MutexGuard<'_, RoomListGroup> {
self.g.lock().unwrap()
}
}
diff --git a/fractal-gtk/src/widgets/roomrow.rs b/fractal-gtk/src/widgets/roomrow.rs
index 53f2eb99..008b12db 100644
--- a/fractal-gtk/src/widgets/roomrow.rs
+++ b/fractal-gtk/src/widgets/roomrow.rs
@@ -4,10 +4,10 @@ use gtk;
use gtk::prelude::*;
use pango;
-use types::Room;
+use crate::types::Room;
-use widgets;
-use widgets::AvatarExt;
+use crate::widgets;
+use crate::widgets::AvatarExt;
const ICON_SIZE: i32 = 24;
diff --git a/fractal-matrix-api/Cargo.toml b/fractal-matrix-api/Cargo.toml
index 83de5a93..1dcc0c06 100644
--- a/fractal-matrix-api/Cargo.toml
+++ b/fractal-matrix-api/Cargo.toml
@@ -3,6 +3,7 @@ authors = ["Daniel Garcia <danigm wadobo com>"]
name = "fractal-matrix-api"
version = "4.0.0"
workspace = "../"
+edition = "2018"
description = """
Library to communicate with a Matrix.org server
@@ -19,8 +20,7 @@ log = "0.4.6"
glib = "0.6.1"
regex = "1.1.0"
reqwest = "0.9.5"
-serde = "1.0.82"
-serde_derive = "1.0.82"
+serde = { version = "1.0.82", features = ["derive"] }
serde_json = "1.0.33"
time = "0.1.41"
tree_magic = "0.2.1"
diff --git a/fractal-matrix-api/src/backend/directory.rs b/fractal-matrix-api/src/backend/directory.rs
index 4b6eda28..b2ab0895 100644
--- a/fractal-matrix-api/src/backend/directory.rs
+++ b/fractal-matrix-api/src/backend/directory.rs
@@ -1,19 +1,20 @@
+use serde_json::json;
use serde_json::Value as JsonValue;
use url::Url;
-use globals;
+use crate::globals;
-use backend::types::BKResponse;
-use backend::types::Backend;
-use error::Error;
+use crate::backend::types::BKResponse;
+use crate::backend::types::Backend;
+use crate::error::Error;
use std::thread;
-use util::cache_path;
-use util::json_q;
-use util::media;
+use crate::util::cache_path;
+use crate::util::json_q;
+use crate::util::media;
-use types::Protocol;
-use types::Room;
+use crate::types::Protocol;
+use crate::types::Room;
pub fn protocols(bk: &Backend) -> Result<(), Error> {
let baseu = bk.get_base_url()?;
diff --git a/fractal-matrix-api/src/backend/media.rs b/fractal-matrix-api/src/backend/media.rs
index aa9871eb..1f1b57bf 100644
--- a/fractal-matrix-api/src/backend/media.rs
+++ b/fractal-matrix-api/src/backend/media.rs
@@ -1,19 +1,19 @@
-use backend::types::BKResponse;
-use backend::types::Backend;
-use error::Error;
-use globals;
+use crate::backend::types::BKResponse;
+use crate::backend::types::Backend;
+use crate::error::Error;
+use crate::globals;
use std::sync::mpsc::Sender;
use std::thread;
-use util;
-use util::cache_dir_path;
-use util::download_file;
-use util::get_room_media_list;
-use util::resolve_media_url;
-use util::semaphore;
-use util::thumb;
+use crate::util;
+use crate::util::cache_dir_path;
+use crate::util::download_file;
+use crate::util::get_room_media_list;
+use crate::util::resolve_media_url;
+use crate::util::semaphore;
+use crate::util::thumb;
-use types::Message;
+use crate::types::Message;
pub fn get_thumb_async(bk: &Backend, media: String, tx: Sender<String>) -> Result<(), Error> {
let baseu = bk.get_base_url()?;
diff --git a/fractal-matrix-api/src/backend/mod.rs b/fractal-matrix-api/src/backend/mod.rs
index d498c458..abd9f8d1 100644
--- a/fractal-matrix-api/src/backend/mod.rs
+++ b/fractal-matrix-api/src/backend/mod.rs
@@ -6,11 +6,11 @@ use std::sync::{Arc, Condvar, Mutex};
use std::thread;
use url::Url;
-use util::client_url;
+use crate::util::client_url;
-use error::Error;
+use crate::error::Error;
-use cache::CacheMap;
+use crate::cache::CacheMap;
mod directory;
mod media;
diff --git a/fractal-matrix-api/src/backend/register.rs b/fractal-matrix-api/src/backend/register.rs
index 4c19ac54..fb769628 100644
--- a/fractal-matrix-api/src/backend/register.rs
+++ b/fractal-matrix-api/src/backend/register.rs
@@ -1,14 +1,15 @@
+use serde_json::json;
use serde_json::Value as JsonValue;
use std::thread;
use url::Url;
-use error::Error;
-use globals;
-use util::json_q;
+use crate::error::Error;
+use crate::globals;
+use crate::util::json_q;
-use backend::types::BKResponse;
-use backend::types::Backend;
+use crate::backend::types::BKResponse;
+use crate::backend::types::Backend;
pub fn guest(bk: &Backend, server: &str) -> Result<(), Error> {
let url = Url::parse(server)
diff --git a/fractal-matrix-api/src/backend/room.rs b/fractal-matrix-api/src/backend/room.rs
index 2f333845..b2a95ac0 100644
--- a/fractal-matrix-api/src/backend/room.rs
+++ b/fractal-matrix-api/src/backend/room.rs
@@ -1,4 +1,6 @@
+use log::error;
use serde_json;
+use serde_json::json;
use urlencoding;
use std::fs::File;
@@ -6,25 +8,25 @@ use std::io::prelude::*;
use std::sync::mpsc::Sender;
use url::Url;
-use error::Error;
-use globals;
+use crate::error::Error;
+use crate::globals;
use std::thread;
-use util;
-use util::cache_path;
-use util::json_q;
-use util::put_media;
-use util::thumb;
-use util::{client_url, media_url};
-
-use backend::types::BKCommand;
-use backend::types::BKResponse;
-use backend::types::Backend;
-use backend::types::RoomType;
-
-use types::Member;
-use types::Message;
-use types::Room;
+use crate::util;
+use crate::util::cache_path;
+use crate::util::json_q;
+use crate::util::put_media;
+use crate::util::thumb;
+use crate::util::{client_url, media_url};
+
+use crate::backend::types::BKCommand;
+use crate::backend::types::BKResponse;
+use crate::backend::types::Backend;
+use crate::backend::types::RoomType;
+
+use crate::types::Member;
+use crate::types::Message;
+use crate::types::Room;
use serde_json::Value as JsonValue;
diff --git a/fractal-matrix-api/src/backend/stickers.rs b/fractal-matrix-api/src/backend/stickers.rs
index ff9110ca..30598450 100644
--- a/fractal-matrix-api/src/backend/stickers.rs
+++ b/fractal-matrix-api/src/backend/stickers.rs
@@ -1,23 +1,24 @@
use chrono::prelude::*;
use md5;
+use serde_json::json;
-use backend::BackendData;
+use crate::backend::BackendData;
+use crate::util::json_q;
+use crate::util::{client_url, scalar_url};
use std::sync::{Arc, Mutex};
use std::thread;
use url::Url;
-use util::json_q;
-use util::{client_url, scalar_url};
-use globals;
+use crate::globals;
//use std::thread;
-use error::Error;
+use crate::error::Error;
-use backend::types::BKCommand;
-use backend::types::BKResponse;
-use backend::types::Backend;
+use crate::backend::types::BKCommand;
+use crate::backend::types::BKResponse;
+use crate::backend::types::Backend;
+use crate::types::Sticker;
+use crate::types::StickerGroup;
use serde_json::Value as JsonValue;
-use types::Sticker;
-use types::StickerGroup;
/// Queries scalar.vector.im to list all the stickers
pub fn list(bk: &Backend) -> Result<(), Error> {
diff --git a/fractal-matrix-api/src/backend/sync.rs b/fractal-matrix-api/src/backend/sync.rs
index f0435820..35f44c14 100644
--- a/fractal-matrix-api/src/backend/sync.rs
+++ b/fractal-matrix-api/src/backend/sync.rs
@@ -1,15 +1,17 @@
-use backend::types::BKResponse;
-use backend::types::Backend;
-use error::Error;
-use globals;
+use crate::backend::types::BKResponse;
+use crate::backend::types::Backend;
+use crate::error::Error;
+use crate::globals;
+use crate::types::Room;
+use crate::util::get_rooms_from_json;
+use crate::util::get_rooms_notifies_from_json;
+use crate::util::get_rooms_timeline_from_json;
+use crate::util::json_q;
+use crate::util::parse_m_direct;
+use crate::util::parse_sync_events;
+use log::error;
+use serde_json::json;
use std::{thread, time};
-use types::Room;
-use util::get_rooms_from_json;
-use util::get_rooms_notifies_from_json;
-use util::get_rooms_timeline_from_json;
-use util::json_q;
-use util::parse_m_direct;
-use util::parse_sync_events;
pub fn sync(bk: &Backend, new_since: Option<String>, initial: bool) -> Result<(), Error> {
let tk = bk.data.lock().unwrap().access_token.clone();
diff --git a/fractal-matrix-api/src/backend/types.rs b/fractal-matrix-api/src/backend/types.rs
index 72d2a20d..a0c7b3eb 100644
--- a/fractal-matrix-api/src/backend/types.rs
+++ b/fractal-matrix-api/src/backend/types.rs
@@ -2,18 +2,18 @@ use std::collections::HashMap;
use std::sync::mpsc::Sender;
use std::sync::{Arc, Condvar, Mutex};
-use error::Error;
+use crate::error::Error;
-use types::Event;
-use types::Member;
-use types::Message;
-use types::Protocol;
-use types::Room;
-use types::Sticker;
-use types::StickerGroup;
-use types::UserInfo;
+use crate::types::Event;
+use crate::types::Member;
+use crate::types::Message;
+use crate::types::Protocol;
+use crate::types::Room;
+use crate::types::Sticker;
+use crate::types::StickerGroup;
+use crate::types::UserInfo;
-use cache::CacheMap;
+use crate::cache::CacheMap;
use url::Url;
#[derive(Debug)]
diff --git a/fractal-matrix-api/src/backend/user.rs b/fractal-matrix-api/src/backend/user.rs
index 1de13089..1d73ed7b 100644
--- a/fractal-matrix-api/src/backend/user.rs
+++ b/fractal-matrix-api/src/backend/user.rs
@@ -1,24 +1,26 @@
+use log::info;
+use serde_json::json;
use std::fs::File;
use std::io::prelude::*;
-use backend::types::BKResponse;
-use backend::types::Backend;
-use error::Error;
-use globals;
+use crate::backend::types::BKResponse;
+use crate::backend::types::Backend;
+use crate::error::Error;
+use crate::globals;
+use crate::util::encode_uid;
+use crate::util::get_user_avatar;
+use crate::util::get_user_avatar_img;
+use crate::util::json_q;
+use crate::util::put_media;
+use crate::util::semaphore;
+use crate::util::{build_url, media_url};
use std::sync::mpsc::Sender;
use std::sync::{Arc, Mutex};
use std::thread;
use url::Url;
-use util::encode_uid;
-use util::get_user_avatar;
-use util::get_user_avatar_img;
-use util::json_q;
-use util::put_media;
-use util::semaphore;
-use util::{build_url, media_url};
-
-use types::Member;
-use types::UserInfo;
+
+use crate::types::Member;
+use crate::types::UserInfo;
use serde_json;
use serde_json::Value as JsonValue;
diff --git a/fractal-matrix-api/src/globals.rs b/fractal-matrix-api/src/globals.rs
index 41156dbf..30852f5c 100644
--- a/fractal-matrix-api/src/globals.rs
+++ b/fractal-matrix-api/src/globals.rs
@@ -1,3 +1,4 @@
+use lazy_static::lazy_static;
use regex::Regex;
pub static TIMEOUT: u64 = 80;
diff --git a/fractal-matrix-api/src/lib.rs b/fractal-matrix-api/src/lib.rs
index 45ae9b65..6fd58229 100644
--- a/fractal-matrix-api/src/lib.rs
+++ b/fractal-matrix-api/src/lib.rs
@@ -1,25 +1,3 @@
-#![deny(unused_extern_crates)]
-
-#[macro_use]
-extern crate serde_json;
-#[macro_use]
-extern crate serde_derive;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate lazy_static;
-
-extern crate cairo;
-extern crate chrono;
-extern crate glib;
-extern crate md5;
-extern crate regex;
-extern crate reqwest;
-extern crate tree_magic;
-extern crate urlencoding;
-
-extern crate url;
-
#[macro_use]
pub mod util;
pub mod error;
diff --git a/fractal-matrix-api/src/model/member.rs b/fractal-matrix-api/src/model/member.rs
index 4cca109b..521617e3 100644
--- a/fractal-matrix-api/src/model/member.rs
+++ b/fractal-matrix-api/src/model/member.rs
@@ -1,3 +1,4 @@
+use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone, Serialize, Deserialize)]
diff --git a/fractal-matrix-api/src/model/message.rs b/fractal-matrix-api/src/model/message.rs
index 24767bff..f9ebc6f3 100644
--- a/fractal-matrix-api/src/model/message.rs
+++ b/fractal-matrix-api/src/model/message.rs
@@ -2,6 +2,7 @@ use chrono::prelude::*;
use chrono::DateTime;
use chrono::TimeZone;
use md5;
+use serde::{Deserialize, Serialize};
use serde_json;
use serde_json::Value as JsonValue;
use std::cmp::Ordering;
diff --git a/fractal-matrix-api/src/model/room.rs b/fractal-matrix-api/src/model/room.rs
index ece0a643..05b301c5 100644
--- a/fractal-matrix-api/src/model/room.rs
+++ b/fractal-matrix-api/src/model/room.rs
@@ -1,8 +1,9 @@
use serde_json::Value as JsonValue;
-use model::member::Member;
-use model::member::MemberList;
-use model::message::Message;
+use crate::model::member::Member;
+use crate::model::member::MemberList;
+use crate::model::message::Message;
+use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone, Serialize, Deserialize)]
diff --git a/fractal-matrix-api/src/model/stickers.rs b/fractal-matrix-api/src/model/stickers.rs
index f6b66e06..42a2a857 100644
--- a/fractal-matrix-api/src/model/stickers.rs
+++ b/fractal-matrix-api/src/model/stickers.rs
@@ -1,3 +1,4 @@
+use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
#[derive(Debug, Clone, Serialize, Deserialize)]
diff --git a/fractal-matrix-api/src/model/userinfo.rs b/fractal-matrix-api/src/model/userinfo.rs
index b5c35b85..5d12fa8f 100644
--- a/fractal-matrix-api/src/model/userinfo.rs
+++ b/fractal-matrix-api/src/model/userinfo.rs
@@ -1,3 +1,5 @@
+use serde::{Deserialize, Serialize};
+
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserInfo {
pub added_at: u64,
diff --git a/fractal-matrix-api/src/types.rs b/fractal-matrix-api/src/types.rs
index 62bdd5d4..854a413f 100644
--- a/fractal-matrix-api/src/types.rs
+++ b/fractal-matrix-api/src/types.rs
@@ -1,10 +1,10 @@
-pub use model::event::Event;
-pub use model::member::Member;
-pub use model::member::MemberList;
-pub use model::message::Message;
-pub use model::protocol::Protocol;
-pub use model::room::Room;
-pub use model::room::RoomList;
-pub use model::stickers::Sticker;
-pub use model::stickers::StickerGroup;
-pub use model::userinfo::UserInfo;
+pub use crate::model::event::Event;
+pub use crate::model::member::Member;
+pub use crate::model::member::MemberList;
+pub use crate::model::message::Message;
+pub use crate::model::protocol::Protocol;
+pub use crate::model::room::Room;
+pub use crate::model::room::RoomList;
+pub use crate::model::stickers::Sticker;
+pub use crate::model::stickers::StickerGroup;
+pub use crate::model::userinfo::UserInfo;
diff --git a/fractal-matrix-api/src/util.rs b/fractal-matrix-api/src/util.rs
index 88dc23e1..2e6a74ee 100644
--- a/fractal-matrix-api/src/util.rs
+++ b/fractal-matrix-api/src/util.rs
@@ -1,4 +1,6 @@
+use log::error;
use reqwest;
+use serde_json::json;
use serde_json::Value as JsonValue;
@@ -21,15 +23,15 @@ use std::thread;
use std::time::Duration as StdDuration;
-use error::Error;
-use types::Event;
-use types::Member;
-use types::Message;
-use types::Room;
+use crate::error::Error;
+use crate::types::Event;
+use crate::types::Member;
+use crate::types::Message;
+use crate::types::Room;
use reqwest::header::CONTENT_TYPE;
-use globals;
+use crate::globals;
pub fn semaphore<F>(thread_count: Arc<(Mutex<u8>, Condvar)>, func: F)
where
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]