use rustc_plugin::Registry;
+pub mod consts;
#[macro_use]
pub mod utils;
+
+// begin lints modules, do not remove this comment, it’s used in `update_lints`
+pub mod approx_const;
+pub mod array_indexing;
+pub mod attrs;
+pub mod bit_mask;
+pub mod block_in_if_condition;
+pub mod collapsible_if;
pub mod copies;
-pub mod consts;
-pub mod types;
-pub mod misc;
+pub mod cyclomatic_complexity;
+pub mod derive;
+pub mod drop_ref;
+pub mod entry;
pub mod enum_glob_use;
+pub mod enum_variants;
pub mod eq_op;
-pub mod bit_mask;
-pub mod ptr_arg;
-pub mod needless_bool;
-pub mod approx_const;
+pub mod escape;
pub mod eta_reduction;
-pub mod enum_variants;
pub mod identity_op;
pub mod items_after_statements;
-pub mod minmax;
-pub mod mut_mut;
-pub mod mut_reference;
pub mod len_zero;
-pub mod attrs;
-pub mod collapsible_if;
-pub mod block_in_if_condition;
-pub mod unicode;
-pub mod shadow;
-pub mod strings;
-pub mod methods;
-pub mod returns;
pub mod lifetimes;
pub mod loops;
-pub mod ranges;
pub mod map_clone;
pub mod matches;
-pub mod precedence;
+pub mod methods;
+pub mod minmax;
+pub mod misc;
+pub mod misc_early;
+pub mod mut_mut;
+pub mod mut_reference;
pub mod mutex_atomic;
-pub mod zero_div_zero;
-pub mod open_options;
+pub mod needless_bool;
pub mod needless_features;
pub mod needless_update;
pub mod no_effect;
-pub mod temporary_assignment;
-pub mod transmute;
-pub mod cyclomatic_complexity;
-pub mod escape;
-pub mod entry;
-pub mod misc_early;
-pub mod array_indexing;
+pub mod open_options;
pub mod panic;
-pub mod derive;
+pub mod precedence;
pub mod print;
-pub mod vec;
-pub mod drop_ref;
+pub mod ptr_arg;
+pub mod ranges;
pub mod regex;
+pub mod returns;
+pub mod shadow;
+pub mod strings;
+pub mod temporary_assignment;
+pub mod transmute;
+pub mod types;
+pub mod unicode;
+pub mod vec;
+pub mod zero_div_zero;
+// end lints modules, do not remove this comment, it’s used in `update_lints`
mod reexport {
pub use syntax::ast::{Name, NodeId};
yield ' %s::%s,\n' % (module, name.upper())
+def gen_mods(lints):
+ """Declare modules"""
+
+ for module in sorted(set(lint[0] for lint in lints)):
+ yield 'pub mod %s;\n' % module
+
+
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.
lambda: ['There are %d lints included in this crate:\n' % len(lints)],
write_back=not check)
+ # update the `pub mod` list
+ changed |= replace_region(
+ 'src/lib.rs', r'begin lints modules', r'end lints modules',
+ lambda: gen_mods(lints),
+ replace_start=False, write_back=not check)
+
# same for "clippy" lint collection
changed |= replace_region(
'src/lib.rs', r'reg.register_lint_group\("clippy"', r'\]\);',