Skip to content

Commit 122ae22

Browse files
committed
Auto merge of rust-lang#9616 - unvalley:add-default-to-lint-groups, r=xFrednet
Add Default to Clippy Lints Lint groups - related to rust-lang#7958 This PR adds a default (reset) button to Clippy Lints Lint groups. (change for website) [The page](https://rust-lang.github.io/rust-clippy/master/index.html) sets only `Deprecated` to false by default. Certainly it is easy to set only `deprecated` to false, but it may be a bit lazy for beginners. https://user-images.githubusercontent.com/38400669/194831117-3ade7e0d-c4de-4189-9daf-3be8ea3cdd18.mov changelog: none
2 parents 8e87d39 + 178799f commit 122ae22

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

util/gh-pages/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,12 @@ <h1>Clippy Lints</h1>
442442
All
443443
</label>
444444
</li>
445+
<li class="checkbox">
446+
<label ng-click="resetGroupsToDefault()">
447+
<input type="checkbox" class="invisible" />
448+
Default
449+
</label>
450+
</li>
445451
<li class="checkbox">
446452
<label ng-click="toggleGroups(false)">
447453
<input type="checkbox" class="invisible" />

util/gh-pages/script.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
return $scope.levels[lint.level];
115115
};
116116

117-
var GROUPS_FILTER_DEFAULT = {
117+
const GROUPS_FILTER_DEFAULT = {
118118
cargo: true,
119119
complexity: true,
120120
correctness: true,
@@ -125,8 +125,12 @@
125125
restriction: true,
126126
style: true,
127127
suspicious: true,
128+
}
129+
130+
$scope.groups = {
131+
...GROUPS_FILTER_DEFAULT
128132
};
129-
$scope.groups = GROUPS_FILTER_DEFAULT;
133+
130134
const THEMES_DEFAULT = {
131135
light: "Light",
132136
rust: "Rust",
@@ -164,6 +168,13 @@
164168
}
165169
};
166170

171+
$scope.resetGroupsToDefault = function () {
172+
const groups = $scope.groups;
173+
for (const [key, value] of Object.entries(GROUPS_FILTER_DEFAULT)) {
174+
groups[key] = value;
175+
}
176+
};
177+
167178
$scope.selectedValuesCount = function (obj) {
168179
return Object.values(obj).filter(x => x).length;
169180
}

0 commit comments

Comments
 (0)