[fractal] Prefer to use `is_empty()`
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal] Prefer to use `is_empty()`
- Date: Thu, 13 Aug 2020 16:20:42 +0000 (UTC)
commit 37fd93b32f4507ec8c5bbf8bcf17e15846f666b9
Author: Yuki Okushi <huyuumi dev gmail com>
Date: Thu Aug 13 19:53:25 2020 +0900
Prefer to use `is_empty()`
fractal-gtk/src/app/connect/account.rs | 4 ++--
fractal-gtk/src/appop/account.rs | 4 ++--
fractal-gtk/src/appop/state.rs | 2 +-
fractal-gtk/src/widgets/address.rs | 2 +-
fractal-gtk/src/widgets/autocomplete.rs | 2 +-
fractal-gtk/src/widgets/room_settings.rs | 4 ++--
6 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/fractal-gtk/src/app/connect/account.rs b/fractal-gtk/src/app/connect/account.rs
index c3a7773e..2caea2f9 100644
--- a/fractal-gtk/src/app/connect/account.rs
+++ b/fractal-gtk/src/app/connect/account.rs
@@ -167,7 +167,7 @@ impl App {
if new != verify {
matching = false;
}
- if new != "" && verify != "" && old != "" {
+ if !new.is_empty() && !verify.is_empty() && !old.is_empty() {
empty = false;
}
}
@@ -216,7 +216,7 @@ impl App {
destruction_entry.connect_property_text_notify(
clone!(@strong destruction_btn => move |w| {
if let Some(text) = w.get_text() {
- if text != "" {
+ if !text.is_empty() {
destruction_btn.set_sensitive(true);
return;
}
diff --git a/fractal-gtk/src/appop/account.rs b/fractal-gtk/src/appop/account.rs
index 136f8f7a..136c0c3c 100644
--- a/fractal-gtk/src/appop/account.rs
+++ b/fractal-gtk/src/appop/account.rs
@@ -104,7 +104,7 @@ impl AppOp {
entry.connect_property_text_notify(move |w| {
if let Some(text) = w.get_text() {
- if text != "" {
+ if !text.is_empty() {
button.set_sensitive(true);
return;
}
@@ -682,7 +682,7 @@ impl AppOp {
if let Some(old) = old_password.get_text() {
if let Some(new) = new_password.get_text() {
- if old != "" && new != "" {
+ if !old.is_empty() && !new.is_empty() {
password_btn.set_sensitive(false);
password_btn_stack.set_visible_child_name("spinner");
thread::spawn(move || {
diff --git a/fractal-gtk/src/appop/state.rs b/fractal-gtk/src/appop/state.rs
index 019e9bf7..6a062a9b 100644
--- a/fractal-gtk/src/appop/state.rs
+++ b/fractal-gtk/src/appop/state.rs
@@ -69,7 +69,7 @@ impl AppOp {
_ => "",
};
- if widget_focus != "" {
+ if !widget_focus.is_empty() {
self.ui
.builder
.get_object::<gtk::Widget>(widget_focus)
diff --git a/fractal-gtk/src/widgets/address.rs b/fractal-gtk/src/widgets/address.rs
index 883d229c..d8da0020 100644
--- a/fractal-gtk/src/widgets/address.rs
+++ b/fractal-gtk/src/widgets/address.rs
@@ -137,7 +137,7 @@ impl<'a> Address<'a> {
let medium = self.medium.clone();
self.entry.connect_property_text_notify(move |w| {
if let Some(text) = w.get_text() {
- if text != "" {
+ if !text.is_empty() {
/* FIXME: use better validation */
match medium {
AddressType::Email => {
diff --git a/fractal-gtk/src/widgets/autocomplete.rs b/fractal-gtk/src/widgets/autocomplete.rs
index 02b1a6e0..697da8ab 100644
--- a/fractal-gtk/src/widgets/autocomplete.rs
+++ b/fractal-gtk/src/widgets/autocomplete.rs
@@ -154,7 +154,7 @@ impl Autocomplete {
let end = buffer.get_end_iter();
match buffer.get_text(&start, &end, false) {
- Some(ref t) if t == "" => {
+ Some(ref t) if t.is_empty() => {
own.borrow_mut().autocomplete_enter();
}
None => {
diff --git a/fractal-gtk/src/widgets/room_settings.rs b/fractal-gtk/src/widgets/room_settings.rs
index 45410482..fde79787 100644
--- a/fractal-gtk/src/widgets/room_settings.rs
+++ b/fractal-gtk/src/widgets/room_settings.rs
@@ -515,7 +515,7 @@ impl RoomSettings {
let room = &self.room;
let old_name = room.name.clone()?;
let new_name = new_name?;
- if new_name != "" && new_name != old_name {
+ if !new_name.is_empty() && new_name != old_name {
return Some(new_name);
}
@@ -526,7 +526,7 @@ impl RoomSettings {
let room = &self.room;
let old_name = room.topic.clone()?;
let new_name = new_name?;
- if new_name != "" && new_name != old_name {
+ if !new_name.is_empty() && new_name != old_name {
return Some(new_name);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]