diff --git a/Cargo.toml b/Cargo.toml index f0abb1e90c0..3d8dbf7c1d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,9 @@ semver = "0.2.1" toml = "0.1" unicode-normalization = "0.1" quine-mc_cluskey = "0.2.2" -clippy_lints = { version = "0.0.*", path = "clippy_lints" } +# begin automatic update +clippy_lints = { version = "0.0.69", path = "clippy_lints" } +# end automatic update [dev-dependencies] compiletest_rs = "0.1.0" diff --git a/clippy_lints/Cargo.toml b/clippy_lints/Cargo.toml index acfb20d9ae6..aa994cd7259 100644 --- a/clippy_lints/Cargo.toml +++ b/clippy_lints/Cargo.toml @@ -1,6 +1,8 @@ [package] name = "clippy_lints" +# begin automatic update version = "0.0.70" +# end automatic update authors = [ "Manish Goregaokar ", "Andre Bogus ", diff --git a/util/update_lints.py b/util/update_lints.py index 8078b68367b..35bddcbbb5c 100755 --- a/util/update_lints.py +++ b/util/update_lints.py @@ -58,9 +58,9 @@ def collect(lints, deprecated_lints, restriction_lints, fn): # remove \-newline escapes from description string desc = nl_escape_re.sub('', match.group('desc')) restriction_lints.append((os.path.splitext(os.path.basename(fn))[0], - match.group('name').lower(), - "allow", - desc.replace('\\"', '"'))) + match.group('name').lower(), + "allow", + desc.replace('\\"', '"'))) def gen_table(lints, link=None): @@ -100,6 +100,7 @@ def gen_deprecated(lints): for lint in lints: yield ' store.register_removed("%s", "%s");\n' % (lint[1], lint[2]) + def replace_region(fn, region_start, region_end, callback, replace_start=True, write_back=True): """Replace a region in a file delimited by two lines matching regexes. @@ -155,6 +156,16 @@ def main(print_only=False, check=False): collect(lints, deprecated_lints, restriction_lints, os.path.join(root, fn)) + # determine version + with open('Cargo.toml') as fp: + for line in fp: + if line.startswith('version ='): + clippy_version = line.split()[2].strip('"') + break + else: + print('Error: version not found in Cargo.toml!') + return + if print_only: sys.stdout.writelines(gen_table(lints + restriction_lints)) return @@ -168,8 +179,8 @@ def main(print_only=False, check=False): changed |= replace_region( 'README.md', r'^There are \d+ lints included in this crate:', "", - lambda: ['There are %d lints included in this crate:\n' % (len(lints) - + len(restriction_lints))], + lambda: ['There are %d lints included in this crate:\n' % + (len(lints) + len(restriction_lints))], write_back=not check) # update the links in the CHANGELOG @@ -182,6 +193,19 @@ def main(print_only=False, check=False): key=lambda l: l[1])], replace_start=False, write_back=not check) + # update version of clippy_lints in Cargo.toml + changed |= replace_region( + 'Cargo.toml', r'# begin automatic update', '# end automatic update', + lambda: ['clippy_lints = { version = "%s", path = "clippy_lints" }\n' % + clippy_version], + replace_start=False, write_back=not check) + + # update version of clippy_lints in Cargo.toml + changed |= replace_region( + 'clippy_lints/Cargo.toml', r'# begin automatic update', '# end automatic update', + lambda: ['version = "%s"\n' % clippy_version], + replace_start=False, write_back=not check) + # update the `pub mod` list changed |= replace_region( 'clippy_lints/src/lib.rs', r'begin lints modules', r'end lints modules', @@ -196,10 +220,10 @@ def main(print_only=False, check=False): # same for "deprecated" lint collection changed |= replace_region( - 'clippy_lints/src/lib.rs', r'let mut store', r'end deprecated lints', - lambda: gen_deprecated(deprecated_lints), - replace_start=False, - write_back=not check) + 'clippy_lints/src/lib.rs', r'let mut store', r'end deprecated lints', + lambda: gen_deprecated(deprecated_lints), + replace_start=False, + write_back=not check) # same for "clippy_pedantic" lint collection changed |= replace_region(