[fractal/remove-clippy-warnings: 2/2] clippy: Rename RelativePosition enum



commit 51da0b9d76660ed4ac63c071b19e71f4a5f4d558
Author: Daniel GarcĂ­a Moreno <dani danigm net>
Date:   Thu Jul 2 09:53:05 2020 +0200

    clippy: Rename RelativePosition enum
    
    This patch changes the RelativePosition enum to follow the enum variant
    names rule:
    https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names

 fractal-gtk/src/widgets/room_history.rs | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/fractal-gtk/src/widgets/room_history.rs b/fractal-gtk/src/widgets/room_history.rs
index c469095b..cea5800e 100644
--- a/fractal-gtk/src/widgets/room_history.rs
+++ b/fractal-gtk/src/widgets/room_history.rs
@@ -140,7 +140,7 @@ impl List {
 
         let sw = self.view.get_scrolled_window();
         let visible_index = match get_rel_position(&sw, &self.list[0]) {
-            RelativePosition::InSight => Some(0),
+            RelativePosition::In => Some(0),
             _ => self.find_visible_index((0, len - 1)),
         };
         if let Some(visible) = visible_index {
@@ -168,15 +168,15 @@ impl List {
         let element = &self.list[middle_index];
         let scrolled_window = self.view.get_scrolled_window();
         match get_rel_position(&scrolled_window, element) {
-            RelativePosition::AboveSight => {
+            RelativePosition::Above => {
                 if range.0 == range.1 {
                     None
                 } else {
                     self.find_visible_index((range.0, middle_index))
                 }
             }
-            RelativePosition::InSight => Some(middle_index),
-            RelativePosition::BelowSight => {
+            RelativePosition::In => Some(middle_index),
+            RelativePosition::Below => {
                 if range.0 == range.1 {
                     None
                 } else {
@@ -193,7 +193,7 @@ impl List {
         let scrolled_window = self.view.get_scrolled_window();
         for (index, element) in iterator {
             match get_rel_position(&scrolled_window, element) {
-                RelativePosition::InSight => {
+                RelativePosition::In => {
                     indices.push(index);
                 }
                 _ => {
@@ -212,19 +212,19 @@ fn get_rel_position(scrolled_window: &gtk::ScrolledWindow, element: &Element) ->
         .expect("Both scrolled_window and widget should be realized and share a common toplevel.")
         .1;
     if rel_y <= -height_widget {
-        RelativePosition::AboveSight
+        RelativePosition::Above
     } else if rel_y < height_visible_area {
-        RelativePosition::InSight
+        RelativePosition::In
     } else {
-        RelativePosition::BelowSight
+        RelativePosition::Below
     }
 }
 
 #[derive(Clone, Debug)]
 enum RelativePosition {
-    InSight,
-    AboveSight,
-    BelowSight,
+    In,
+    Above,
+    Below,
 }
 
 /* These Enum contains all differnet types of rows the room history can have, e.g room message, new


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