This finishes up the rewrite of `update_lints.py` in Rust. More
specifically, this
* adds the `--check` flag and handling to clippy_dev
* tracks file changes over the different calls to `replace_region_in_file`
* only writes changes to files if the `--check` flag is *not* used
* runs `./util/dev update_lints --check` on CI instead of the old script
* replaces usage of the `update_lints.py` script with an error
`./util/dev update_lints` behaves 99% the same as the python script.
The only difference that I'm aware of is an ordering change to
`clippy_lints/src/lib.rs` because underscores seem to be sorted
differently in Rust and in Python.
🏁
The update script now also generates the 'register_removed' section in
`clippy_lints/src/lib.rs`.
Also, instead of using `let mut store ...`, I added a new identifier
line so that the replacement will continue to work in case `let mut
store ...` ever changes.
This makes sure that empty lines in lint examples are preserved.
It also fixes the documentation for the invalid_ref lint, which was not
shown because of an extra newline before the lint declaration.
This introduces a very sophisticated algorithm to determine the ordering
of versions on the rendered docs' start page.
(Spoiler alert: It maps "master" and "current" to the largest possible
float values and converts a version like "1.2.3" to "1002003".)
Uses basically the same code as the lint docs page as I didn't want to
reinvent anything: A simple python script (inline in deploy script)
writes an array of versions to a JSON file, which gets turned into a
list of links using a bit of angular.js code.
Fixes#1917
The trick to writing horrible hacks such as this is to recognize angular
as a technology stack that may be endearing to some as one can do easy
stuff quickly. But fundamentally, it is built on top of crazy shit.
Like: Yes, I just wrote a directive that for some reason automatically
has access to the scope of the repeated item, and fires an event each
time the last `np-repeat` item was seen (delayed by one render loop
cycle, of course). And – obviously – when defining the directive it is
in camelCase but when using it in the template it has to by in
dash-case.
Great times.