diff options
| author | Serial <69764315+Serial-ATA@users.noreply.github.com> | 2022-05-15 11:30:00 -0400 |
|---|---|---|
| committer | Serial <69764315+Serial-ATA@users.noreply.github.com> | 2022-05-15 11:30:00 -0400 |
| commit | b81d7039704d2b9f84c7a90eee923a4a7a5304ac (patch) | |
| tree | 9559e323b71dddf6901f3d73875ef203c19a71bd | |
| parent | a30587e0fe5bc35f4ca9ea885b27bc93dbfced89 (diff) | |
| download | rust-b81d7039704d2b9f84c7a90eee923a4a7a5304ac.tar.gz rust-b81d7039704d2b9f84c7a90eee923a4a7a5304ac.zip | |
Use early returns
| -rw-r--r-- | util/gh-pages/index.html | 7 | ||||
| -rw-r--r-- | util/gh-pages/script.js | 20 |
2 files changed, 12 insertions, 15 deletions
diff --git a/util/gh-pages/index.html b/util/gh-pages/index.html index 8bba9640a77..2f586077af5 100644 --- a/util/gh-pages/index.html +++ b/util/gh-pages/index.html @@ -110,6 +110,7 @@ Otherwise, have a great day =^.^= left: auto; } + <!-- TODO --> #version-filter-count { display: none; } @@ -291,7 +292,7 @@ Otherwise, have a great day =^.^= border: 1px solid var(--theme-popup-border); } - #version-filter-selector .item { + #version-filter-selector .checkbox { display: flex; } @@ -440,14 +441,14 @@ Otherwise, have a great day =^.^= <span class="caret"></span> </button> <ul id="version-filter-selector" class="dropdown-menu"> - <li class="item"> + <li class="checkbox"> <label ng-click="clearVersionFilters()"> <input type="checkbox" class="invisible" /> Clear filters </label> </li> <li role="separator" class="divider"></li> - <li class="item" ng-repeat="(filter, vars) in versionFilters"> + <li class="checkbox" ng-repeat="(filter, vars) in versionFilters"> <label ng-attr-for="filter-{filter}">{{filter}}</label> <span>1.</span> <input type="number" diff --git a/util/gh-pages/script.js b/util/gh-pages/script.js index f72fe8c7f8b..174758ad931 100644 --- a/util/gh-pages/script.js +++ b/util/gh-pages/script.js @@ -185,6 +185,7 @@ // 1.29.0 and greater if (minorVersion && minorVersion > 28) { $scope.versionFilters[filter].enabled = true; + continue; } $scope.versionFilters[filter].enabled = false; @@ -201,25 +202,20 @@ let lintVersion = lint.version.startsWith("pre ") ? lint.version.substring(4, lint.version.length) : lint.version; let lintMinorVersion = lintVersion.substring(2, 4); - let result; switch (filter) { + // "=" gets the highest priority, since all filters are inclusive + case "=": + return (lintMinorVersion == minorVersion); case "≥": - result = (lintMinorVersion >= minorVersion); + if (lintMinorVersion < minorVersion) { return false; } break; case "≤": - result = (lintMinorVersion <= minorVersion); + if (lintMinorVersion > minorVersion) { return false; } break; - // "=" gets the highest priority, since all filters are inclusive - case "=": - return (lintMinorVersion == minorVersion); default: return true } - if (!result) { - return false; - } - let cmpFilter; if (filter === "≥") { cmpFilter = "≤"; @@ -229,10 +225,10 @@ if (filters[cmpFilter].enabled) { let cmpMinorVersion = filters[cmpFilter].minorVersion; - result = (cmpFilter === "≥") ? (lintMinorVersion >= cmpMinorVersion) : (lintMinorVersion <= cmpMinorVersion); + return (cmpFilter === "≥") ? (lintMinorVersion >= cmpMinorVersion) : (lintMinorVersion <= cmpMinorVersion); } - return result; + return true; } } |
