1
Fork 0

Autogenerate CHANGELOG links to lints in wiki

This commit is contained in:
mcarton 2016-04-14 17:56:46 +02:00
parent 3511297330
commit d81481bd0d
2 changed files with 140 additions and 3 deletions

View file

@ -135,7 +135,7 @@ def main(print_only=False, check=False):
return
# collect all lints from source files
for root, dirs, files in os.walk('src'):
for root, _, files in os.walk('src'):
for fn in files:
if fn.endswith('.rs'):
collect(lints, deprecated_lints, os.path.join(root, fn))
@ -156,6 +156,15 @@ def main(print_only=False, check=False):
lambda: ['There are %d lints included in this crate:\n' % len(lints)],
write_back=not check)
# update the links in the CHANGELOG
changed |= replace_region(
'CHANGELOG.md',
"<!-- begin autogenerated links to wiki -->",
"<!-- end autogenerated links to wiki -->",
lambda: ["[`{0}`]: {1}#{0}\n".format(l[1], wiki_link) for l in
sorted(lints + deprecated_lints, key=lambda l: l[1])],
replace_start=False, write_back=not check)
# update the `pub mod` list
changed |= replace_region(
'src/lib.rs', r'begin lints modules', r'end lints modules',