[fractal] rust: fix some warnings
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal] rust: fix some warnings
- Date: Mon, 15 Apr 2019 06:31:16 +0000 (UTC)
commit 7eec414e3ce2e76465d2f24708c5828d237480f3
Author: Alexandre Franke <afranke gnome org>
Date: Sun Apr 14 17:13:54 2019 +0200
rust: fix some warnings
fractal-gtk/src/appop/message.rs | 6 +++---
fractal-gtk/src/widgets/autocomplete.rs | 2 +-
fractal-gtk/src/widgets/avatar.rs | 2 +-
fractal-matrix-api/src/client.rs | 6 +++---
4 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/fractal-gtk/src/appop/message.rs b/fractal-gtk/src/appop/message.rs
index b0f11898..a5826067 100644
--- a/fractal-gtk/src/appop/message.rs
+++ b/fractal-gtk/src/appop/message.rs
@@ -197,7 +197,7 @@ impl AppOp {
let mut m = Message::new(room, sender, body, mtype);
if msg.starts_with("/me ") {
- m.body = msg.trim_left_matches("/me ").to_owned();
+ m.body = msg.trim_start_matches("/me ").to_owned();
m.mtype = String::from("m.emote");
}
@@ -390,7 +390,7 @@ impl AppOp {
pub fn create_new_room_message(&self, msg: &Message) -> Option<MessageContent> {
let mut highlights = vec![];
lazy_static! {
- static ref emoji_regex: regex::Regex = regex::Regex::new(r"(?x)
+ static ref EMOJI_REGEX: regex::Regex = regex::Regex::new(r"(?x)
^
[\p{White_Space}\p{Emoji}\p{Emoji_Presentation}\p{Emoji_Modifier}\p{Emoji_Modifier_Base}\p{Emoji_Component}]*
[\p{Emoji}]+
@@ -426,7 +426,7 @@ impl AppOp {
highlights.push(String::from("message_menu"));
RowType::Mention
- } else if emoji_regex.is_match(&msg.body) {
+ } else if EMOJI_REGEX.is_match(&msg.body) {
RowType::Emoji
} else {
RowType::Message
diff --git a/fractal-gtk/src/widgets/autocomplete.rs b/fractal-gtk/src/widgets/autocomplete.rs
index 863ea55a..b02d8e32 100644
--- a/fractal-gtk/src/widgets/autocomplete.rs
+++ b/fractal-gtk/src/widgets/autocomplete.rs
@@ -438,7 +438,7 @@ impl Autocomplete {
.alias
.clone()
.unwrap_or_default()
- .trim_right_matches(" (IRC)")
+ .trim_end_matches(" (IRC)")
.to_owned();
let widget;
{
diff --git a/fractal-gtk/src/widgets/avatar.rs b/fractal-gtk/src/widgets/avatar.rs
index c2efc757..8d04c07b 100644
--- a/fractal-gtk/src/widgets/avatar.rs
+++ b/fractal-gtk/src/widgets/avatar.rs
@@ -107,7 +107,7 @@ impl AvatarExt for gtk::Overlay {
let uname = username.clone();
/* remove IRC postfix from the username */
let username = if let Some(u) = username {
- Some(u.trim_right_matches(" (IRC)").to_owned())
+ Some(u.trim_end_matches(" (IRC)").to_owned())
} else {
None
};
diff --git a/fractal-matrix-api/src/client.rs b/fractal-matrix-api/src/client.rs
index 8c4ee9f1..01067fad 100644
--- a/fractal-matrix-api/src/client.rs
+++ b/fractal-matrix-api/src/client.rs
@@ -53,7 +53,7 @@ impl ProxySettings {
// gio::ProxyResolver can't be sent or shared
thread_local! {
- static proxy_resolver: gio::ProxyResolver =
+ static PROXY_RESOLVER: gio::ProxyResolver =
gio::ProxyResolver::get_default().expect("Couldn't get proxy resolver");
}
@@ -82,8 +82,8 @@ impl Client {
// Lock first so we don't overwrite proxy settings with outdated information
let mut inner = self.inner.lock().unwrap();
- let http_proxy = proxy_resolver.with(|resolver| resolver.lookup("http://", None))?;
- let https_proxy = proxy_resolver.with(|resolver| resolver.lookup("https://", None))?;
+ let http_proxy = PROXY_RESOLVER.with(|resolver| resolver.lookup("http://", None))?;
+ let https_proxy = PROXY_RESOLVER.with(|resolver| resolver.lookup("https://", None))?;
let new_proxy_settings = ProxySettings::new(http_proxy, https_proxy);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]