Auto merge of #9616 - unvalley:add-default-to-lint-groups, r=xFrednet

Add Default to Clippy Lints Lint groups

- related to #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
This commit is contained in:
bors 2022-10-11 08:35:12 +00:00
commit 122ae22897
2 changed files with 19 additions and 2 deletions

View File

@ -442,6 +442,12 @@ Otherwise, have a great day =^.^=
All
</label>
</li>
<li class="checkbox">
<label ng-click="resetGroupsToDefault()">
<input type="checkbox" class="invisible" />
Default
</label>
</li>
<li class="checkbox">
<label ng-click="toggleGroups(false)">
<input type="checkbox" class="invisible" />

View File

@ -114,7 +114,7 @@
return $scope.levels[lint.level];
};
var GROUPS_FILTER_DEFAULT = {
const GROUPS_FILTER_DEFAULT = {
cargo: true,
complexity: true,
correctness: true,
@ -125,8 +125,12 @@
restriction: true,
style: true,
suspicious: true,
}
$scope.groups = {
...GROUPS_FILTER_DEFAULT
};
$scope.groups = GROUPS_FILTER_DEFAULT;
const THEMES_DEFAULT = {
light: "Light",
rust: "Rust",
@ -164,6 +168,13 @@
}
};
$scope.resetGroupsToDefault = function () {
const groups = $scope.groups;
for (const [key, value] of Object.entries(GROUPS_FILTER_DEFAULT)) {
groups[key] = value;
}
};
$scope.selectedValuesCount = function (obj) {
return Object.values(obj).filter(x => x).length;
}