[gnome-shell-extensions] cleanup: Avoid unnecessary parentheses



commit e217f2376741a16517dc8e98248c8c0e27435319
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Aug 7 03:47:39 2019 +0200

    cleanup: Avoid unnecessary parentheses
    
    Extra parentheses usually add noise rather than clarity, so avoid
    them.
    
    https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/91

 extensions/apps-menu/extension.js               |  4 ++--
 extensions/native-window-placement/extension.js | 12 ++++++------
 extensions/screenshot-window-sizer/extension.js |  4 ++--
 extensions/window-list/extension.js             |  2 +-
 extensions/windowsNavigator/extension.js        |  2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index 84ec5cd..51d1902 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -55,7 +55,7 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem {
         let draggable = DND.makeDraggable(this);
 
         let maybeStartDrag = draggable._maybeStartDrag;
-        draggable._maybeStartDrag = (event) => {
+        draggable._maybeStartDrag = event => {
             if (this._dragEnabled)
                 return maybeStartDrag.call(draggable, event);
             return false;
@@ -174,7 +174,7 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem {
         // Check which side of line AB the point P lies on by taking the
         // cross-product of AB and AP. See:
         // http://stackoverflow.com/questions/3461453/determine-which-side-of-a-line-a-point-lies
-        if (((this.width * y) - (NAVIGATION_REGION_OVERSHOOT * x)) <= 0)
+        if (this.width * y - NAVIGATION_REGION_OVERSHOOT * x <= 0)
             return true;
 
         return false;
diff --git a/extensions/native-window-placement/extension.js b/extensions/native-window-placement/extension.js
index 110fe28..dfe4165 100644
--- a/extensions/native-window-placement/extension.js
+++ b/extensions/native-window-placement/extension.js
@@ -46,10 +46,10 @@ class Rect {
     }
 
     overlap(rect2) {
-        return !((this.x + this.width    <= rect2.x) ||
-                 (rect2.x + rect2.width  <= this.x) ||
-                 (this.y + this.height   <= rect2.y) ||
-                 (rect2.y + rect2.height <= this.y));
+        return !(this.x + this.width    <= rect2.x ||
+                 rect2.x + rect2.width  <= this.x ||
+                 this.y + this.height   <= rect2.y ||
+                 rect2.y + rect2.height <= this.y);
     }
 
     center() {
@@ -162,9 +162,9 @@ class NaturalLayoutStrategy extends Workspace.LayoutStrategy {
                             diff[1] = 0;
                             if (xSection != 1 || ySection != 1) { // Remove this if you want the center to 
pull as well
                                 if (xSection == 1)
-                                    xSection = (directions[i] / 2 ? 2 : 0);
+                                    xSection = directions[i] / 2 ? 2 : 0;
                                 if (ySection == 1)
-                                    ySection = (directions[i] % 2 ? 2 : 0);
+                                    ySection = directions[i] % 2 ? 2 : 0;
                             }
                             if (xSection == 0 && ySection == 0) {
                                 diff[0] = bounds.x - iCenter[0];
diff --git a/extensions/screenshot-window-sizer/extension.js b/extensions/screenshot-window-sizer/extension.js
index 4c1d1bb..54e1d2c 100644
--- a/extensions/screenshot-window-sizer/extension.js
+++ b/extensions/screenshot-window-sizer/extension.js
@@ -122,8 +122,8 @@ function cycleScreenshotSizes(display, window, binding) {
 
     let newOuterRect = window.get_frame_rect();
     let message = '%d×%d'.format(
-        (newOuterRect.width / scaleFactor),
-        (newOuterRect.height / scaleFactor));
+        newOuterRect.width / scaleFactor,
+        newOuterRect.height / scaleFactor);
 
     // The new size might have been constrained by geometry hints (e.g. for
     // a terminal) - in that case, include the actual ratio to the message
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index ec6dbbe..6e57c30 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -894,7 +894,7 @@ const WindowList = GObject.registerClass({
         let maxWidth = this._getMaxWindowListWidth();
         let natWidth = this._getPreferredUngroupedWindowListWidth();
 
-        let grouped = (maxWidth < natWidth);
+        let grouped = maxWidth < natWidth;
         if (this._grouped !== grouped) {
             this._grouped = grouped;
             this._populateWindowList();
diff --git a/extensions/windowsNavigator/extension.js b/extensions/windowsNavigator/extension.js
index 0164e5b..02f07b5 100644
--- a/extensions/windowsNavigator/extension.js
+++ b/extensions/windowsNavigator/extension.js
@@ -91,7 +91,7 @@ var MyWorkspace = class extends Workspace.Workspace {
 
     getWindowWithTooltip(id) {
         for (let i = 0; i < this._windows.length; i++) {
-            if ((this._windows[i].slotId + 1) == id)
+            if (this._windows[i].slotId + 1 == id)
                 return this._windows[i].metaWindow;
         }
         return null;


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