cleanup: Avoid unnecessary braces

Our coding style has always been to avoid braces when all blocks
are single-lines.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
This commit is contained in:
Florian Müllner
2019-08-20 02:51:42 +02:00
committed by Georges Basile Stavracas Neto
parent 69f63dc94f
commit 67ea424525
38 changed files with 136 additions and 201 deletions

View File

@ -82,11 +82,11 @@ var HistoryManager = class {
_onEntryKeyPress(entry, event) {
let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_Up) {
if (symbol == Clutter.KEY_Up)
return this._setPrevItem(entry.get_text());
} else if (symbol == Clutter.KEY_Down) {
else if (symbol == Clutter.KEY_Down)
return this._setNextItem(entry.get_text());
}
return Clutter.EVENT_PROPAGATE;
}

View File

@ -11,9 +11,8 @@ function getCompletions(text, commandHeader, globalCompletionList) {
let methods = [];
let expr_, base;
let attrHead = '';
if (globalCompletionList == null) {
if (globalCompletionList == null)
globalCompletionList = [];
}
let offset = getExpressionOffset(text, text.length - 1);
if (offset >= 0) {
@ -59,9 +58,8 @@ function isStopChar(c) {
function findMatchingQuote(expr, offset) {
let quoteChar = expr.charAt(offset);
for (let i = offset - 1; i >= 0; --i) {
if (expr.charAt(i) == quoteChar && expr.charAt(i - 1) != '\\') {
if (expr.charAt(i) == quoteChar && expr.charAt(i - 1) != '\\')
return i;
}
}
return -1;
}
@ -69,9 +67,8 @@ function findMatchingQuote(expr, offset) {
// Given the ending position of a regex, find where it starts
function findMatchingSlash(expr, offset) {
for (let i = offset - 1; i >= 0; --i) {
if (expr.charAt(i) == '/' && expr.charAt(i - 1) != '\\') {
if (expr.charAt(i) == '/' && expr.charAt(i - 1) != '\\')
return i;
}
}
return -1;
}
@ -117,13 +114,11 @@ function getExpressionOffset(expr, offset) {
while (offset >= 0) {
let currChar = expr.charAt(offset);
if (isStopChar(currChar)) {
if (isStopChar(currChar))
return offset + 1;
}
if (currChar.match(/[)\]]/)) {
if (currChar.match(/[)\]]/))
offset = findMatchingBrace(expr, offset);
}
--offset;
}
@ -140,9 +135,9 @@ function isValidPropertyName(w) {
// To get all properties (enumerable and not), we need to walk
// the prototype chain ourselves
function getAllProps(obj) {
if (obj === null || obj === undefined) {
if (obj === null || obj === undefined)
return [];
}
return Object.getOwnPropertyNames(obj).concat( getAllProps(Object.getPrototypeOf(obj)) );
}

View File

@ -192,9 +192,8 @@ var ObjectManager = class {
_onNameAppeared() {
this._managerProxy.GetManagedObjectsRemote((result, error) => {
if (!result) {
if (error) {
if (error)
logError(error, `could not get remote objects for service ${this._serviceName} path ${this._managerPath}`);
}
this._tryToCompleteLoad();
return;

View File

@ -72,11 +72,10 @@ var SmartcardManager = class {
if ('IsInserted' in properties.deep_unpack()) {
this._updateToken(token);
if (token.IsInserted) {
if (token.IsInserted)
this.emit('smartcard-inserted', token);
} else {
else
this.emit('smartcard-removed', token);
}
}
});