]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/clippy_lints/src/lib.rs
Auto merge of #100315 - compiler-errors:norm-ct-in-proj, r=lcnr
[rust.git] / src / tools / clippy / clippy_lints / src / lib.rs
1 #![feature(array_windows)]
2 #![feature(binary_heap_into_iter_sorted)]
3 #![feature(box_patterns)]
4 #![feature(control_flow_enum)]
5 #![feature(drain_filter)]
6 #![feature(iter_intersperse)]
7 #![cfg_attr(bootstrap, feature(let_chains))]
8 #![feature(let_else)]
9 #![feature(lint_reasons)]
10 #![feature(never_type)]
11 #![feature(once_cell)]
12 #![feature(rustc_private)]
13 #![feature(stmt_expr_attributes)]
14 #![recursion_limit = "512"]
15 #![cfg_attr(feature = "deny-warnings", deny(warnings))]
16 #![allow(clippy::missing_docs_in_private_items, clippy::must_use_candidate)]
17 #![warn(trivial_casts, trivial_numeric_casts)]
18 // warn on lints, that are included in `rust-lang/rust`s bootstrap
19 #![warn(rust_2018_idioms, unused_lifetimes)]
20 // warn on rustc internal lints
21 #![warn(rustc::internal)]
22 // Disable this rustc lint for now, as it was also done in rustc
23 #![allow(rustc::potential_query_instability)]
24
25 // FIXME: switch to something more ergonomic here, once available.
26 // (Currently there is no way to opt into sysroot crates without `extern crate`.)
27 extern crate rustc_arena;
28 extern crate rustc_ast;
29 extern crate rustc_ast_pretty;
30 extern crate rustc_attr;
31 extern crate rustc_data_structures;
32 extern crate rustc_driver;
33 extern crate rustc_errors;
34 extern crate rustc_hir;
35 extern crate rustc_hir_pretty;
36 extern crate rustc_index;
37 extern crate rustc_infer;
38 extern crate rustc_lexer;
39 extern crate rustc_lint;
40 extern crate rustc_middle;
41 extern crate rustc_mir_dataflow;
42 extern crate rustc_parse;
43 extern crate rustc_parse_format;
44 extern crate rustc_session;
45 extern crate rustc_span;
46 extern crate rustc_target;
47 extern crate rustc_trait_selection;
48 extern crate rustc_typeck;
49
50 #[macro_use]
51 extern crate clippy_utils;
52
53 use clippy_utils::parse_msrv;
54 use rustc_data_structures::fx::FxHashSet;
55 use rustc_lint::LintId;
56 use rustc_semver::RustcVersion;
57 use rustc_session::Session;
58
59 /// Macro used to declare a Clippy lint.
60 ///
61 /// Every lint declaration consists of 4 parts:
62 ///
63 /// 1. The documentation, which is used for the website
64 /// 2. The `LINT_NAME`. See [lint naming][lint_naming] on lint naming conventions.
65 /// 3. The `lint_level`, which is a mapping from *one* of our lint groups to `Allow`, `Warn` or
66 ///    `Deny`. The lint level here has nothing to do with what lint groups the lint is a part of.
67 /// 4. The `description` that contains a short explanation on what's wrong with code where the
68 ///    lint is triggered.
69 ///
70 /// Currently the categories `style`, `correctness`, `suspicious`, `complexity` and `perf` are
71 /// enabled by default. As said in the README.md of this repository, if the lint level mapping
72 /// changes, please update README.md.
73 ///
74 /// # Example
75 ///
76 /// ```
77 /// #![feature(rustc_private)]
78 /// extern crate rustc_session;
79 /// use rustc_session::declare_tool_lint;
80 /// use clippy_lints::declare_clippy_lint;
81 ///
82 /// declare_clippy_lint! {
83 ///     /// ### What it does
84 ///     /// Checks for ... (describe what the lint matches).
85 ///     ///
86 ///     /// ### Why is this bad?
87 ///     /// Supply the reason for linting the code.
88 ///     ///
89 ///     /// ### Example
90 ///     /// ```rust
91 ///     /// Insert a short example of code that triggers the lint
92 ///     /// ```
93 ///     ///
94 ///     /// Use instead:
95 ///     /// ```rust
96 ///     /// Insert a short example of improved code that doesn't trigger the lint
97 ///     /// ```
98 ///     pub LINT_NAME,
99 ///     pedantic,
100 ///     "description"
101 /// }
102 /// ```
103 /// [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
104 #[macro_export]
105 macro_rules! declare_clippy_lint {
106     { $(#[$attr:meta])* pub $name:tt, style, $description:tt } => {
107         declare_tool_lint! {
108             $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
109         }
110     };
111     { $(#[$attr:meta])* pub $name:tt, correctness, $description:tt } => {
112         declare_tool_lint! {
113             $(#[$attr])* pub clippy::$name, Deny, $description, report_in_external_macro: true
114         }
115     };
116     { $(#[$attr:meta])* pub $name:tt, suspicious, $description:tt } => {
117         declare_tool_lint! {
118             $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
119         }
120     };
121     { $(#[$attr:meta])* pub $name:tt, complexity, $description:tt } => {
122         declare_tool_lint! {
123             $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
124         }
125     };
126     { $(#[$attr:meta])* pub $name:tt, perf, $description:tt } => {
127         declare_tool_lint! {
128             $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
129         }
130     };
131     { $(#[$attr:meta])* pub $name:tt, pedantic, $description:tt } => {
132         declare_tool_lint! {
133             $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
134         }
135     };
136     { $(#[$attr:meta])* pub $name:tt, restriction, $description:tt } => {
137         declare_tool_lint! {
138             $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
139         }
140     };
141     { $(#[$attr:meta])* pub $name:tt, cargo, $description:tt } => {
142         declare_tool_lint! {
143             $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
144         }
145     };
146     { $(#[$attr:meta])* pub $name:tt, nursery, $description:tt } => {
147         declare_tool_lint! {
148             $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
149         }
150     };
151     { $(#[$attr:meta])* pub $name:tt, internal, $description:tt } => {
152         declare_tool_lint! {
153             $(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
154         }
155     };
156     { $(#[$attr:meta])* pub $name:tt, internal_warn, $description:tt } => {
157         declare_tool_lint! {
158             $(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
159         }
160     };
161 }
162
163 #[cfg(feature = "internal")]
164 pub mod deprecated_lints;
165 #[cfg_attr(feature = "internal", allow(clippy::missing_clippy_version_attribute))]
166 mod utils;
167
168 mod renamed_lints;
169
170 // begin lints modules, do not remove this comment, it’s used in `update_lints`
171 mod almost_complete_letter_range;
172 mod approx_const;
173 mod as_conversions;
174 mod as_underscore;
175 mod asm_syntax;
176 mod assertions_on_constants;
177 mod assertions_on_result_states;
178 mod async_yields_async;
179 mod attrs;
180 mod await_holding_invalid;
181 mod blacklisted_name;
182 mod blocks_in_if_conditions;
183 mod bool_assert_comparison;
184 mod booleans;
185 mod borrow_as_ptr;
186 mod borrow_deref_ref;
187 mod bytecount;
188 mod bytes_count_to_len;
189 mod cargo;
190 mod case_sensitive_file_extension_comparisons;
191 mod casts;
192 mod checked_conversions;
193 mod cognitive_complexity;
194 mod collapsible_if;
195 mod comparison_chain;
196 mod copies;
197 mod copy_iterator;
198 mod crate_in_macro_def;
199 mod create_dir;
200 mod dbg_macro;
201 mod default;
202 mod default_instead_of_iter_empty;
203 mod default_numeric_fallback;
204 mod default_union_representation;
205 mod dereference;
206 mod derivable_impls;
207 mod derive;
208 mod disallowed_methods;
209 mod disallowed_script_idents;
210 mod disallowed_types;
211 mod doc;
212 mod doc_link_with_quotes;
213 mod double_parens;
214 mod drop_forget_ref;
215 mod duplicate_mod;
216 mod else_if_without_else;
217 mod empty_drop;
218 mod empty_enum;
219 mod empty_structs_with_brackets;
220 mod entry;
221 mod enum_clike;
222 mod enum_variants;
223 mod equatable_if_let;
224 mod escape;
225 mod eta_reduction;
226 mod excessive_bools;
227 mod exhaustive_items;
228 mod exit;
229 mod explicit_write;
230 mod fallible_impl_from;
231 mod float_literal;
232 mod floating_point_arithmetic;
233 mod format;
234 mod format_args;
235 mod format_impl;
236 mod format_push_string;
237 mod formatting;
238 mod from_over_into;
239 mod from_str_radix_10;
240 mod functions;
241 mod future_not_send;
242 mod get_first;
243 mod if_let_mutex;
244 mod if_not_else;
245 mod if_then_some_else_none;
246 mod implicit_hasher;
247 mod implicit_return;
248 mod implicit_saturating_sub;
249 mod inconsistent_struct_constructor;
250 mod index_refutable_slice;
251 mod indexing_slicing;
252 mod infinite_iter;
253 mod inherent_impl;
254 mod inherent_to_string;
255 mod init_numbered_fields;
256 mod inline_fn_without_body;
257 mod int_plus_one;
258 mod invalid_upcast_comparisons;
259 mod invalid_utf8_in_unchecked;
260 mod items_after_statements;
261 mod iter_not_returning_iterator;
262 mod large_const_arrays;
263 mod large_enum_variant;
264 mod large_include_file;
265 mod large_stack_arrays;
266 mod len_zero;
267 mod let_if_seq;
268 mod let_underscore;
269 mod lifetimes;
270 mod literal_representation;
271 mod loops;
272 mod macro_use;
273 mod main_recursion;
274 mod manual_assert;
275 mod manual_async_fn;
276 mod manual_bits;
277 mod manual_non_exhaustive;
278 mod manual_ok_or;
279 mod manual_rem_euclid;
280 mod manual_retain;
281 mod manual_strip;
282 mod map_clone;
283 mod map_err_ignore;
284 mod map_unit_fn;
285 mod match_result_ok;
286 mod matches;
287 mod mem_forget;
288 mod mem_replace;
289 mod methods;
290 mod minmax;
291 mod misc;
292 mod misc_early;
293 mod mismatching_type_param_order;
294 mod missing_const_for_fn;
295 mod missing_doc;
296 mod missing_enforced_import_rename;
297 mod missing_inline;
298 mod mixed_read_write_in_expression;
299 mod module_style;
300 mod mut_key;
301 mod mut_mut;
302 mod mut_mutex_lock;
303 mod mut_reference;
304 mod mutable_debug_assertion;
305 mod mutex_atomic;
306 mod needless_arbitrary_self_type;
307 mod needless_bool;
308 mod needless_borrowed_ref;
309 mod needless_continue;
310 mod needless_for_each;
311 mod needless_late_init;
312 mod needless_parens_on_range_literals;
313 mod needless_pass_by_value;
314 mod needless_question_mark;
315 mod needless_update;
316 mod neg_cmp_op_on_partial_ord;
317 mod neg_multiply;
318 mod new_without_default;
319 mod no_effect;
320 mod non_copy_const;
321 mod non_expressive_names;
322 mod non_octal_unix_permissions;
323 mod non_send_fields_in_send_ty;
324 mod nonstandard_macro_braces;
325 mod octal_escapes;
326 mod only_used_in_recursion;
327 mod open_options;
328 mod operators;
329 mod option_env_unwrap;
330 mod option_if_let_else;
331 mod overflow_check_conditional;
332 mod panic_in_result_fn;
333 mod panic_unimplemented;
334 mod partialeq_ne_impl;
335 mod pass_by_ref_or_value;
336 mod path_buf_push_overwrite;
337 mod pattern_type_mismatch;
338 mod precedence;
339 mod ptr;
340 mod ptr_offset_with_cast;
341 mod pub_use;
342 mod question_mark;
343 mod ranges;
344 mod rc_clone_in_vec_init;
345 mod read_zero_byte_vec;
346 mod redundant_clone;
347 mod redundant_closure_call;
348 mod redundant_else;
349 mod redundant_field_names;
350 mod redundant_pub_crate;
351 mod redundant_slicing;
352 mod redundant_static_lifetimes;
353 mod ref_option_ref;
354 mod reference;
355 mod regex;
356 mod repeat_once;
357 mod return_self_not_must_use;
358 mod returns;
359 mod same_name_method;
360 mod self_named_constructors;
361 mod semicolon_if_nothing_returned;
362 mod serde_api;
363 mod shadow;
364 mod single_char_lifetime_names;
365 mod single_component_path_imports;
366 mod size_of_in_element_count;
367 mod slow_vector_initialization;
368 mod stable_sort_primitive;
369 mod std_instead_of_core;
370 mod strings;
371 mod strlen_on_c_strings;
372 mod suspicious_operation_groupings;
373 mod suspicious_trait_impl;
374 mod swap;
375 mod swap_ptr_to_ref;
376 mod tabs_in_doc_comments;
377 mod temporary_assignment;
378 mod to_digit_is_some;
379 mod trailing_empty_array;
380 mod trait_bounds;
381 mod transmute;
382 mod transmuting_null;
383 mod types;
384 mod undocumented_unsafe_blocks;
385 mod unicode;
386 mod uninit_vec;
387 mod unit_hash;
388 mod unit_return_expecting_ord;
389 mod unit_types;
390 mod unnamed_address;
391 mod unnecessary_owned_empty_strings;
392 mod unnecessary_self_imports;
393 mod unnecessary_sort_by;
394 mod unnecessary_wraps;
395 mod unnested_or_patterns;
396 mod unsafe_removed_from_name;
397 mod unused_async;
398 mod unused_io_amount;
399 mod unused_rounding;
400 mod unused_self;
401 mod unused_unit;
402 mod unwrap;
403 mod unwrap_in_result;
404 mod upper_case_acronyms;
405 mod use_self;
406 mod useless_conversion;
407 mod vec;
408 mod vec_init_then_push;
409 mod vec_resize_to_zero;
410 mod verbose_file_reads;
411 mod wildcard_imports;
412 mod write;
413 mod zero_div_zero;
414 mod zero_sized_map_values;
415 // end lints modules, do not remove this comment, it’s used in `update_lints`
416
417 pub use crate::utils::conf::Conf;
418 use crate::utils::conf::{format_error, TryConf};
419
420 /// Register all pre expansion lints
421 ///
422 /// Pre-expansion lints run before any macro expansion has happened.
423 ///
424 /// Note that due to the architecture of the compiler, currently `cfg_attr` attributes on crate
425 /// level (i.e `#![cfg_attr(...)]`) will still be expanded even when using a pre-expansion pass.
426 ///
427 /// Used in `./src/driver.rs`.
428 pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore, sess: &Session, conf: &Conf) {
429     // NOTE: Do not add any more pre-expansion passes. These should be removed eventually.
430
431     let msrv = conf.msrv.as_ref().and_then(|s| {
432         parse_msrv(s, None, None).or_else(|| {
433             sess.err(&format!(
434                 "error reading Clippy's configuration file. `{}` is not a valid Rust version",
435                 s
436             ));
437             None
438         })
439     });
440
441     store.register_pre_expansion_pass(|| Box::new(write::Write::default()));
442     store.register_pre_expansion_pass(move || Box::new(attrs::EarlyAttributes { msrv }));
443 }
444
445 fn read_msrv(conf: &Conf, sess: &Session) -> Option<RustcVersion> {
446     let cargo_msrv = std::env::var("CARGO_PKG_RUST_VERSION")
447         .ok()
448         .and_then(|v| parse_msrv(&v, None, None));
449     let clippy_msrv = conf.msrv.as_ref().and_then(|s| {
450         parse_msrv(s, None, None).or_else(|| {
451             sess.err(&format!(
452                 "error reading Clippy's configuration file. `{}` is not a valid Rust version",
453                 s
454             ));
455             None
456         })
457     });
458
459     if let Some(cargo_msrv) = cargo_msrv {
460         if let Some(clippy_msrv) = clippy_msrv {
461             // if both files have an msrv, let's compare them and emit a warning if they differ
462             if clippy_msrv != cargo_msrv {
463                 sess.warn(&format!(
464                     "the MSRV in `clippy.toml` and `Cargo.toml` differ; using `{}` from `clippy.toml`",
465                     clippy_msrv
466                 ));
467             }
468
469             Some(clippy_msrv)
470         } else {
471             Some(cargo_msrv)
472         }
473     } else {
474         clippy_msrv
475     }
476 }
477
478 #[doc(hidden)]
479 pub fn read_conf(sess: &Session) -> Conf {
480     let file_name = match utils::conf::lookup_conf_file() {
481         Ok(Some(path)) => path,
482         Ok(None) => return Conf::default(),
483         Err(error) => {
484             sess.struct_err(&format!("error finding Clippy's configuration file: {}", error))
485                 .emit();
486             return Conf::default();
487         },
488     };
489
490     let TryConf { conf, errors } = utils::conf::read(&file_name);
491     // all conf errors are non-fatal, we just use the default conf in case of error
492     for error in errors {
493         sess.err(&format!(
494             "error reading Clippy's configuration file `{}`: {}",
495             file_name.display(),
496             format_error(error)
497         ));
498     }
499
500     conf
501 }
502
503 /// Register all lints and lint groups with the rustc plugin registry
504 ///
505 /// Used in `./src/driver.rs`.
506 #[expect(clippy::too_many_lines)]
507 pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: &Conf) {
508     register_removed_non_tool_lints(store);
509
510     include!("lib.deprecated.rs");
511
512     include!("lib.register_lints.rs");
513     include!("lib.register_restriction.rs");
514     include!("lib.register_pedantic.rs");
515
516     #[cfg(feature = "internal")]
517     include!("lib.register_internal.rs");
518
519     include!("lib.register_all.rs");
520     include!("lib.register_style.rs");
521     include!("lib.register_complexity.rs");
522     include!("lib.register_correctness.rs");
523     include!("lib.register_suspicious.rs");
524     include!("lib.register_perf.rs");
525     include!("lib.register_cargo.rs");
526     include!("lib.register_nursery.rs");
527
528     #[cfg(feature = "internal")]
529     {
530         if std::env::var("ENABLE_METADATA_COLLECTION").eq(&Ok("1".to_string())) {
531             store.register_late_pass(|| Box::new(utils::internal_lints::metadata_collector::MetadataCollector::new()));
532             return;
533         }
534     }
535
536     // all the internal lints
537     #[cfg(feature = "internal")]
538     {
539         store.register_early_pass(|| Box::new(utils::internal_lints::ClippyLintsInternal));
540         store.register_early_pass(|| Box::new(utils::internal_lints::ProduceIce));
541         store.register_late_pass(|| Box::new(utils::internal_lints::CollapsibleCalls));
542         store.register_late_pass(|| Box::new(utils::internal_lints::CompilerLintFunctions::new()));
543         store.register_late_pass(|| Box::new(utils::internal_lints::IfChainStyle));
544         store.register_late_pass(|| Box::new(utils::internal_lints::InvalidPaths));
545         store.register_late_pass(|| Box::new(utils::internal_lints::InterningDefinedSymbol::default()));
546         store.register_late_pass(|| Box::new(utils::internal_lints::LintWithoutLintPass::default()));
547         store.register_late_pass(|| Box::new(utils::internal_lints::MatchTypeOnDiagItem));
548         store.register_late_pass(|| Box::new(utils::internal_lints::OuterExpnDataPass));
549         store.register_late_pass(|| Box::new(utils::internal_lints::MsrvAttrImpl));
550     }
551
552     let arithmetic_allowed = conf.arithmetic_allowed.clone();
553     store.register_late_pass(move || Box::new(operators::arithmetic::Arithmetic::new(arithmetic_allowed.clone())));
554     store.register_late_pass(|| Box::new(utils::dump_hir::DumpHir));
555     store.register_late_pass(|| Box::new(utils::author::Author));
556     let await_holding_invalid_types = conf.await_holding_invalid_types.clone();
557     store.register_late_pass(move || {
558         Box::new(await_holding_invalid::AwaitHolding::new(
559             await_holding_invalid_types.clone(),
560         ))
561     });
562     store.register_late_pass(|| Box::new(serde_api::SerdeApi));
563     let vec_box_size_threshold = conf.vec_box_size_threshold;
564     let type_complexity_threshold = conf.type_complexity_threshold;
565     let avoid_breaking_exported_api = conf.avoid_breaking_exported_api;
566     store.register_late_pass(move || {
567         Box::new(types::Types::new(
568             vec_box_size_threshold,
569             type_complexity_threshold,
570             avoid_breaking_exported_api,
571         ))
572     });
573     store.register_late_pass(|| Box::new(booleans::NonminimalBool));
574     store.register_late_pass(|| Box::new(enum_clike::UnportableVariant));
575     store.register_late_pass(|| Box::new(float_literal::FloatLiteral));
576     store.register_late_pass(|| Box::new(ptr::Ptr));
577     store.register_late_pass(|| Box::new(needless_bool::NeedlessBool));
578     store.register_late_pass(|| Box::new(needless_bool::BoolComparison));
579     store.register_late_pass(|| Box::new(needless_for_each::NeedlessForEach));
580     store.register_late_pass(|| Box::new(misc::MiscLints));
581     store.register_late_pass(|| Box::new(eta_reduction::EtaReduction));
582     store.register_late_pass(|| Box::new(mut_mut::MutMut));
583     store.register_late_pass(|| Box::new(mut_reference::UnnecessaryMutPassed));
584     store.register_late_pass(|| Box::new(len_zero::LenZero));
585     store.register_late_pass(|| Box::new(attrs::Attributes));
586     store.register_late_pass(|| Box::new(blocks_in_if_conditions::BlocksInIfConditions));
587     store.register_late_pass(|| Box::new(unicode::Unicode));
588     store.register_late_pass(|| Box::new(uninit_vec::UninitVec));
589     store.register_late_pass(|| Box::new(unit_hash::UnitHash));
590     store.register_late_pass(|| Box::new(unit_return_expecting_ord::UnitReturnExpectingOrd));
591     store.register_late_pass(|| Box::new(strings::StringAdd));
592     store.register_late_pass(|| Box::new(implicit_return::ImplicitReturn));
593     store.register_late_pass(|| Box::new(implicit_saturating_sub::ImplicitSaturatingSub));
594     store.register_late_pass(|| Box::new(default_numeric_fallback::DefaultNumericFallback));
595     store.register_late_pass(|| Box::new(inconsistent_struct_constructor::InconsistentStructConstructor));
596     store.register_late_pass(|| Box::new(non_octal_unix_permissions::NonOctalUnixPermissions));
597     store.register_early_pass(|| Box::new(unnecessary_self_imports::UnnecessarySelfImports));
598
599     let msrv = read_msrv(conf, sess);
600     let avoid_breaking_exported_api = conf.avoid_breaking_exported_api;
601     let allow_expect_in_tests = conf.allow_expect_in_tests;
602     let allow_unwrap_in_tests = conf.allow_unwrap_in_tests;
603     store.register_late_pass(move || Box::new(approx_const::ApproxConstant::new(msrv)));
604     store.register_late_pass(move || {
605         Box::new(methods::Methods::new(
606             avoid_breaking_exported_api,
607             msrv,
608             allow_expect_in_tests,
609             allow_unwrap_in_tests,
610         ))
611     });
612     store.register_late_pass(move || Box::new(matches::Matches::new(msrv)));
613     store.register_early_pass(move || Box::new(manual_non_exhaustive::ManualNonExhaustiveStruct::new(msrv)));
614     store.register_late_pass(move || Box::new(manual_non_exhaustive::ManualNonExhaustiveEnum::new(msrv)));
615     store.register_late_pass(move || Box::new(manual_strip::ManualStrip::new(msrv)));
616     store.register_early_pass(move || Box::new(redundant_static_lifetimes::RedundantStaticLifetimes::new(msrv)));
617     store.register_early_pass(move || Box::new(redundant_field_names::RedundantFieldNames::new(msrv)));
618     store.register_late_pass(move || Box::new(checked_conversions::CheckedConversions::new(msrv)));
619     store.register_late_pass(move || Box::new(mem_replace::MemReplace::new(msrv)));
620     store.register_late_pass(move || Box::new(ranges::Ranges::new(msrv)));
621     store.register_late_pass(move || Box::new(from_over_into::FromOverInto::new(msrv)));
622     store.register_late_pass(move || Box::new(use_self::UseSelf::new(msrv)));
623     store.register_late_pass(move || Box::new(missing_const_for_fn::MissingConstForFn::new(msrv)));
624     store.register_late_pass(move || Box::new(needless_question_mark::NeedlessQuestionMark));
625     store.register_late_pass(move || Box::new(casts::Casts::new(msrv)));
626     store.register_early_pass(move || Box::new(unnested_or_patterns::UnnestedOrPatterns::new(msrv)));
627     store.register_late_pass(move || Box::new(map_clone::MapClone::new(msrv)));
628
629     store.register_late_pass(|| Box::new(size_of_in_element_count::SizeOfInElementCount));
630     store.register_late_pass(|| Box::new(same_name_method::SameNameMethod));
631     let max_suggested_slice_pattern_length = conf.max_suggested_slice_pattern_length;
632     store.register_late_pass(move || {
633         Box::new(index_refutable_slice::IndexRefutableSlice::new(
634             max_suggested_slice_pattern_length,
635             msrv,
636         ))
637     });
638     store.register_late_pass(|| Box::new(map_err_ignore::MapErrIgnore));
639     store.register_late_pass(|| Box::new(shadow::Shadow::default()));
640     store.register_late_pass(|| Box::new(unit_types::UnitTypes));
641     store.register_late_pass(|| Box::new(loops::Loops));
642     store.register_late_pass(|| Box::new(main_recursion::MainRecursion::default()));
643     store.register_late_pass(|| Box::new(lifetimes::Lifetimes));
644     store.register_late_pass(|| Box::new(entry::HashMapPass));
645     store.register_late_pass(|| Box::new(minmax::MinMaxPass));
646     store.register_late_pass(|| Box::new(open_options::OpenOptions));
647     store.register_late_pass(|| Box::new(zero_div_zero::ZeroDiv));
648     store.register_late_pass(|| Box::new(mutex_atomic::Mutex));
649     store.register_late_pass(|| Box::new(needless_update::NeedlessUpdate));
650     store.register_late_pass(|| Box::new(needless_borrowed_ref::NeedlessBorrowedRef));
651     store.register_late_pass(|| Box::new(borrow_deref_ref::BorrowDerefRef));
652     store.register_late_pass(|| Box::new(no_effect::NoEffect));
653     store.register_late_pass(|| Box::new(temporary_assignment::TemporaryAssignment));
654     store.register_late_pass(move || Box::new(transmute::Transmute::new(msrv)));
655     let cognitive_complexity_threshold = conf.cognitive_complexity_threshold;
656     store.register_late_pass(move || {
657         Box::new(cognitive_complexity::CognitiveComplexity::new(
658             cognitive_complexity_threshold,
659         ))
660     });
661     let too_large_for_stack = conf.too_large_for_stack;
662     store.register_late_pass(move || Box::new(escape::BoxedLocal { too_large_for_stack }));
663     store.register_late_pass(move || Box::new(vec::UselessVec { too_large_for_stack }));
664     store.register_late_pass(|| Box::new(panic_unimplemented::PanicUnimplemented));
665     store.register_late_pass(|| Box::new(strings::StringLitAsBytes));
666     store.register_late_pass(|| Box::new(derive::Derive));
667     store.register_late_pass(|| Box::new(derivable_impls::DerivableImpls));
668     store.register_late_pass(|| Box::new(drop_forget_ref::DropForgetRef));
669     store.register_late_pass(|| Box::new(empty_enum::EmptyEnum));
670     store.register_late_pass(|| Box::new(invalid_upcast_comparisons::InvalidUpcastComparisons));
671     store.register_late_pass(|| Box::new(regex::Regex));
672     store.register_late_pass(|| Box::new(copies::CopyAndPaste));
673     store.register_late_pass(|| Box::new(copy_iterator::CopyIterator));
674     store.register_late_pass(|| Box::new(format::UselessFormat));
675     store.register_late_pass(|| Box::new(swap::Swap));
676     store.register_late_pass(|| Box::new(overflow_check_conditional::OverflowCheckConditional));
677     store.register_late_pass(|| Box::new(new_without_default::NewWithoutDefault::default()));
678     let blacklisted_names = conf.blacklisted_names.iter().cloned().collect::<FxHashSet<_>>();
679     store.register_late_pass(move || Box::new(blacklisted_name::BlacklistedName::new(blacklisted_names.clone())));
680     let too_many_arguments_threshold = conf.too_many_arguments_threshold;
681     let too_many_lines_threshold = conf.too_many_lines_threshold;
682     store.register_late_pass(move || {
683         Box::new(functions::Functions::new(
684             too_many_arguments_threshold,
685             too_many_lines_threshold,
686         ))
687     });
688     let doc_valid_idents = conf.doc_valid_idents.iter().cloned().collect::<FxHashSet<_>>();
689     store.register_late_pass(move || Box::new(doc::DocMarkdown::new(doc_valid_idents.clone())));
690     store.register_late_pass(|| Box::new(neg_multiply::NegMultiply));
691     store.register_late_pass(|| Box::new(mem_forget::MemForget));
692     store.register_late_pass(|| Box::new(let_if_seq::LetIfSeq));
693     store.register_late_pass(|| Box::new(mixed_read_write_in_expression::EvalOrderDependence));
694     store.register_late_pass(|| Box::new(missing_doc::MissingDoc::new()));
695     store.register_late_pass(|| Box::new(missing_inline::MissingInline));
696     store.register_late_pass(move || Box::new(exhaustive_items::ExhaustiveItems));
697     store.register_late_pass(|| Box::new(match_result_ok::MatchResultOk));
698     store.register_late_pass(|| Box::new(partialeq_ne_impl::PartialEqNeImpl));
699     store.register_late_pass(|| Box::new(unused_io_amount::UnusedIoAmount));
700     let enum_variant_size_threshold = conf.enum_variant_size_threshold;
701     store.register_late_pass(move || Box::new(large_enum_variant::LargeEnumVariant::new(enum_variant_size_threshold)));
702     store.register_late_pass(|| Box::new(explicit_write::ExplicitWrite));
703     store.register_late_pass(|| Box::new(needless_pass_by_value::NeedlessPassByValue));
704     let pass_by_ref_or_value = pass_by_ref_or_value::PassByRefOrValue::new(
705         conf.trivial_copy_size_limit,
706         conf.pass_by_value_size_limit,
707         conf.avoid_breaking_exported_api,
708         &sess.target,
709     );
710     store.register_late_pass(move || Box::new(pass_by_ref_or_value));
711     store.register_late_pass(|| Box::new(ref_option_ref::RefOptionRef));
712     store.register_late_pass(|| Box::new(bytecount::ByteCount));
713     store.register_late_pass(|| Box::new(infinite_iter::InfiniteIter));
714     store.register_late_pass(|| Box::new(inline_fn_without_body::InlineFnWithoutBody));
715     store.register_late_pass(|| Box::new(useless_conversion::UselessConversion::default()));
716     store.register_late_pass(|| Box::new(implicit_hasher::ImplicitHasher));
717     store.register_late_pass(|| Box::new(fallible_impl_from::FallibleImplFrom));
718     store.register_late_pass(|| Box::new(question_mark::QuestionMark));
719     store.register_early_pass(|| Box::new(suspicious_operation_groupings::SuspiciousOperationGroupings));
720     store.register_late_pass(|| Box::new(suspicious_trait_impl::SuspiciousImpl));
721     store.register_late_pass(|| Box::new(map_unit_fn::MapUnit));
722     store.register_late_pass(|| Box::new(inherent_impl::MultipleInherentImpl));
723     store.register_late_pass(|| Box::new(neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd));
724     store.register_late_pass(|| Box::new(unwrap::Unwrap));
725     store.register_late_pass(|| Box::new(indexing_slicing::IndexingSlicing));
726     store.register_late_pass(|| Box::new(non_copy_const::NonCopyConst));
727     store.register_late_pass(|| Box::new(ptr_offset_with_cast::PtrOffsetWithCast));
728     store.register_late_pass(|| Box::new(redundant_clone::RedundantClone));
729     store.register_late_pass(|| Box::new(slow_vector_initialization::SlowVectorInit));
730     store.register_late_pass(|| Box::new(unnecessary_sort_by::UnnecessarySortBy));
731     store.register_late_pass(move || Box::new(unnecessary_wraps::UnnecessaryWraps::new(avoid_breaking_exported_api)));
732     store.register_late_pass(|| Box::new(assertions_on_constants::AssertionsOnConstants));
733     store.register_late_pass(|| Box::new(assertions_on_result_states::AssertionsOnResultStates));
734     store.register_late_pass(|| Box::new(transmuting_null::TransmutingNull));
735     store.register_late_pass(|| Box::new(path_buf_push_overwrite::PathBufPushOverwrite));
736     store.register_late_pass(|| Box::new(inherent_to_string::InherentToString));
737     let max_trait_bounds = conf.max_trait_bounds;
738     store.register_late_pass(move || Box::new(trait_bounds::TraitBounds::new(max_trait_bounds)));
739     store.register_late_pass(|| Box::new(comparison_chain::ComparisonChain));
740     store.register_late_pass(|| Box::new(mut_key::MutableKeyType));
741     store.register_early_pass(|| Box::new(reference::DerefAddrOf));
742     store.register_early_pass(|| Box::new(double_parens::DoubleParens));
743     store.register_late_pass(|| Box::new(format_impl::FormatImpl::new()));
744     store.register_early_pass(|| Box::new(unsafe_removed_from_name::UnsafeNameRemoval));
745     store.register_early_pass(|| Box::new(else_if_without_else::ElseIfWithoutElse));
746     store.register_early_pass(|| Box::new(int_plus_one::IntPlusOne));
747     store.register_early_pass(|| Box::new(formatting::Formatting));
748     store.register_early_pass(|| Box::new(misc_early::MiscEarlyLints));
749     store.register_early_pass(|| Box::new(redundant_closure_call::RedundantClosureCall));
750     store.register_late_pass(|| Box::new(redundant_closure_call::RedundantClosureCall));
751     store.register_early_pass(|| Box::new(unused_unit::UnusedUnit));
752     store.register_late_pass(|| Box::new(returns::Return));
753     store.register_early_pass(|| Box::new(collapsible_if::CollapsibleIf));
754     store.register_early_pass(|| Box::new(items_after_statements::ItemsAfterStatements));
755     store.register_early_pass(|| Box::new(precedence::Precedence));
756     store.register_late_pass(|| Box::new(needless_parens_on_range_literals::NeedlessParensOnRangeLiterals));
757     store.register_early_pass(|| Box::new(needless_continue::NeedlessContinue));
758     store.register_early_pass(|| Box::new(redundant_else::RedundantElse));
759     store.register_late_pass(|| Box::new(create_dir::CreateDir));
760     store.register_early_pass(|| Box::new(needless_arbitrary_self_type::NeedlessArbitrarySelfType));
761     let literal_representation_lint_fraction_readability = conf.unreadable_literal_lint_fractions;
762     store.register_early_pass(move || {
763         Box::new(literal_representation::LiteralDigitGrouping::new(
764             literal_representation_lint_fraction_readability,
765         ))
766     });
767     let literal_representation_threshold = conf.literal_representation_threshold;
768     store.register_early_pass(move || {
769         Box::new(literal_representation::DecimalLiteralRepresentation::new(
770             literal_representation_threshold,
771         ))
772     });
773     let enum_variant_name_threshold = conf.enum_variant_name_threshold;
774     store.register_late_pass(move || {
775         Box::new(enum_variants::EnumVariantNames::new(
776             enum_variant_name_threshold,
777             avoid_breaking_exported_api,
778         ))
779     });
780     store.register_early_pass(|| Box::new(tabs_in_doc_comments::TabsInDocComments));
781     let upper_case_acronyms_aggressive = conf.upper_case_acronyms_aggressive;
782     store.register_late_pass(move || {
783         Box::new(upper_case_acronyms::UpperCaseAcronyms::new(
784             avoid_breaking_exported_api,
785             upper_case_acronyms_aggressive,
786         ))
787     });
788     store.register_late_pass(|| Box::new(default::Default::default()));
789     store.register_late_pass(move || Box::new(unused_self::UnusedSelf::new(avoid_breaking_exported_api)));
790     store.register_late_pass(|| Box::new(mutable_debug_assertion::DebugAssertWithMutCall));
791     store.register_late_pass(|| Box::new(exit::Exit));
792     store.register_late_pass(|| Box::new(to_digit_is_some::ToDigitIsSome));
793     let array_size_threshold = conf.array_size_threshold;
794     store.register_late_pass(move || Box::new(large_stack_arrays::LargeStackArrays::new(array_size_threshold)));
795     store.register_late_pass(move || Box::new(large_const_arrays::LargeConstArrays::new(array_size_threshold)));
796     store.register_late_pass(|| Box::new(floating_point_arithmetic::FloatingPointArithmetic));
797     store.register_early_pass(|| Box::new(as_conversions::AsConversions));
798     store.register_late_pass(|| Box::new(let_underscore::LetUnderscore));
799     store.register_early_pass(|| Box::new(single_component_path_imports::SingleComponentPathImports));
800     let max_fn_params_bools = conf.max_fn_params_bools;
801     let max_struct_bools = conf.max_struct_bools;
802     store.register_early_pass(move || {
803         Box::new(excessive_bools::ExcessiveBools::new(
804             max_struct_bools,
805             max_fn_params_bools,
806         ))
807     });
808     store.register_early_pass(|| Box::new(option_env_unwrap::OptionEnvUnwrap));
809     let warn_on_all_wildcard_imports = conf.warn_on_all_wildcard_imports;
810     store.register_late_pass(move || Box::new(wildcard_imports::WildcardImports::new(warn_on_all_wildcard_imports)));
811     store.register_late_pass(|| Box::new(verbose_file_reads::VerboseFileReads));
812     store.register_late_pass(|| Box::new(redundant_pub_crate::RedundantPubCrate::default()));
813     store.register_late_pass(|| Box::new(unnamed_address::UnnamedAddress));
814     store.register_late_pass(|| Box::new(dereference::Dereferencing::default()));
815     store.register_late_pass(|| Box::new(option_if_let_else::OptionIfLetElse));
816     store.register_late_pass(|| Box::new(future_not_send::FutureNotSend));
817     store.register_late_pass(|| Box::new(if_let_mutex::IfLetMutex));
818     store.register_late_pass(|| Box::new(if_not_else::IfNotElse));
819     store.register_late_pass(|| Box::new(equatable_if_let::PatternEquality));
820     store.register_late_pass(|| Box::new(mut_mutex_lock::MutMutexLock));
821     store.register_late_pass(|| Box::new(manual_async_fn::ManualAsyncFn));
822     store.register_late_pass(|| Box::new(vec_resize_to_zero::VecResizeToZero));
823     store.register_late_pass(|| Box::new(panic_in_result_fn::PanicInResultFn));
824     let single_char_binding_names_threshold = conf.single_char_binding_names_threshold;
825     store.register_early_pass(move || {
826         Box::new(non_expressive_names::NonExpressiveNames {
827             single_char_binding_names_threshold,
828         })
829     });
830     let macro_matcher = conf.standard_macro_braces.iter().cloned().collect::<FxHashSet<_>>();
831     store.register_early_pass(move || Box::new(nonstandard_macro_braces::MacroBraces::new(&macro_matcher)));
832     store.register_late_pass(|| Box::new(macro_use::MacroUseImports::default()));
833     store.register_late_pass(|| Box::new(pattern_type_mismatch::PatternTypeMismatch));
834     store.register_late_pass(|| Box::new(stable_sort_primitive::StableSortPrimitive));
835     store.register_late_pass(|| Box::new(repeat_once::RepeatOnce));
836     store.register_late_pass(|| Box::new(unwrap_in_result::UnwrapInResult));
837     store.register_late_pass(|| Box::new(manual_ok_or::ManualOkOr));
838     store.register_late_pass(|| Box::new(semicolon_if_nothing_returned::SemicolonIfNothingReturned));
839     store.register_late_pass(|| Box::new(async_yields_async::AsyncYieldsAsync));
840     let disallowed_methods = conf.disallowed_methods.clone();
841     store.register_late_pass(move || Box::new(disallowed_methods::DisallowedMethods::new(disallowed_methods.clone())));
842     store.register_early_pass(|| Box::new(asm_syntax::InlineAsmX86AttSyntax));
843     store.register_early_pass(|| Box::new(asm_syntax::InlineAsmX86IntelSyntax));
844     store.register_late_pass(|| Box::new(empty_drop::EmptyDrop));
845     store.register_late_pass(|| Box::new(strings::StrToString));
846     store.register_late_pass(|| Box::new(strings::StringToString));
847     store.register_late_pass(|| Box::new(zero_sized_map_values::ZeroSizedMapValues));
848     store.register_late_pass(|| Box::new(vec_init_then_push::VecInitThenPush::default()));
849     store.register_late_pass(|| {
850         Box::new(case_sensitive_file_extension_comparisons::CaseSensitiveFileExtensionComparisons)
851     });
852     store.register_late_pass(|| Box::new(redundant_slicing::RedundantSlicing));
853     store.register_late_pass(|| Box::new(from_str_radix_10::FromStrRadix10));
854     store.register_late_pass(move || Box::new(if_then_some_else_none::IfThenSomeElseNone::new(msrv)));
855     store.register_late_pass(|| Box::new(bool_assert_comparison::BoolAssertComparison));
856     store.register_early_pass(move || Box::new(module_style::ModStyle));
857     store.register_late_pass(|| Box::new(unused_async::UnusedAsync));
858     let disallowed_types = conf.disallowed_types.clone();
859     store.register_late_pass(move || Box::new(disallowed_types::DisallowedTypes::new(disallowed_types.clone())));
860     let import_renames = conf.enforced_import_renames.clone();
861     store.register_late_pass(move || {
862         Box::new(missing_enforced_import_rename::ImportRename::new(
863             import_renames.clone(),
864         ))
865     });
866     let scripts = conf.allowed_scripts.clone();
867     store.register_early_pass(move || Box::new(disallowed_script_idents::DisallowedScriptIdents::new(&scripts)));
868     store.register_late_pass(|| Box::new(strlen_on_c_strings::StrlenOnCStrings));
869     store.register_late_pass(move || Box::new(self_named_constructors::SelfNamedConstructors));
870     store.register_late_pass(move || Box::new(iter_not_returning_iterator::IterNotReturningIterator));
871     store.register_late_pass(move || Box::new(manual_assert::ManualAssert));
872     let enable_raw_pointer_heuristic_for_send = conf.enable_raw_pointer_heuristic_for_send;
873     store.register_late_pass(move || {
874         Box::new(non_send_fields_in_send_ty::NonSendFieldInSendTy::new(
875             enable_raw_pointer_heuristic_for_send,
876         ))
877     });
878     store.register_late_pass(move || Box::new(undocumented_unsafe_blocks::UndocumentedUnsafeBlocks));
879     store.register_late_pass(move || Box::new(format_args::FormatArgs));
880     store.register_late_pass(|| Box::new(trailing_empty_array::TrailingEmptyArray));
881     store.register_early_pass(|| Box::new(octal_escapes::OctalEscapes));
882     store.register_late_pass(|| Box::new(needless_late_init::NeedlessLateInit));
883     store.register_late_pass(|| Box::new(return_self_not_must_use::ReturnSelfNotMustUse));
884     store.register_late_pass(|| Box::new(init_numbered_fields::NumberedFields));
885     store.register_early_pass(|| Box::new(single_char_lifetime_names::SingleCharLifetimeNames));
886     store.register_late_pass(move || Box::new(borrow_as_ptr::BorrowAsPtr::new(msrv)));
887     store.register_late_pass(move || Box::new(manual_bits::ManualBits::new(msrv)));
888     store.register_late_pass(|| Box::new(default_union_representation::DefaultUnionRepresentation));
889     store.register_early_pass(|| Box::new(doc_link_with_quotes::DocLinkWithQuotes));
890     store.register_late_pass(|| Box::new(only_used_in_recursion::OnlyUsedInRecursion));
891     let allow_dbg_in_tests = conf.allow_dbg_in_tests;
892     store.register_late_pass(move || Box::new(dbg_macro::DbgMacro::new(allow_dbg_in_tests)));
893     let cargo_ignore_publish = conf.cargo_ignore_publish;
894     store.register_late_pass(move || {
895         Box::new(cargo::Cargo {
896             ignore_publish: cargo_ignore_publish,
897         })
898     });
899     store.register_early_pass(|| Box::new(crate_in_macro_def::CrateInMacroDef));
900     store.register_early_pass(|| Box::new(empty_structs_with_brackets::EmptyStructsWithBrackets));
901     store.register_late_pass(|| Box::new(unnecessary_owned_empty_strings::UnnecessaryOwnedEmptyStrings));
902     store.register_early_pass(|| Box::new(pub_use::PubUse));
903     store.register_late_pass(|| Box::new(format_push_string::FormatPushString));
904     store.register_late_pass(|| Box::new(bytes_count_to_len::BytesCountToLen));
905     let max_include_file_size = conf.max_include_file_size;
906     store.register_late_pass(move || Box::new(large_include_file::LargeIncludeFile::new(max_include_file_size)));
907     store.register_late_pass(|| Box::new(strings::TrimSplitWhitespace));
908     store.register_late_pass(|| Box::new(rc_clone_in_vec_init::RcCloneInVecInit));
909     store.register_early_pass(|| Box::new(duplicate_mod::DuplicateMod::default()));
910     store.register_late_pass(|| Box::new(get_first::GetFirst));
911     store.register_early_pass(|| Box::new(unused_rounding::UnusedRounding));
912     store.register_early_pass(move || Box::new(almost_complete_letter_range::AlmostCompleteLetterRange::new(msrv)));
913     store.register_late_pass(|| Box::new(swap_ptr_to_ref::SwapPtrToRef));
914     store.register_late_pass(|| Box::new(mismatching_type_param_order::TypeParamMismatch));
915     store.register_late_pass(|| Box::new(as_underscore::AsUnderscore));
916     store.register_late_pass(|| Box::new(read_zero_byte_vec::ReadZeroByteVec));
917     store.register_late_pass(|| Box::new(default_instead_of_iter_empty::DefaultIterEmpty));
918     store.register_late_pass(move || Box::new(manual_rem_euclid::ManualRemEuclid::new(msrv)));
919     store.register_late_pass(move || Box::new(manual_retain::ManualRetain::new(msrv)));
920     let verbose_bit_mask_threshold = conf.verbose_bit_mask_threshold;
921     store.register_late_pass(move || Box::new(operators::Operators::new(verbose_bit_mask_threshold)));
922     store.register_late_pass(|| Box::new(invalid_utf8_in_unchecked::InvalidUtf8InUnchecked));
923     store.register_late_pass(|| Box::new(std_instead_of_core::StdReexports::default()));
924     // add lints here, do not remove this comment, it's used in `new_lint`
925 }
926
927 #[rustfmt::skip]
928 fn register_removed_non_tool_lints(store: &mut rustc_lint::LintStore) {
929     store.register_removed(
930         "should_assert_eq",
931         "`assert!()` will be more flexible with RFC 2011",
932     );
933     store.register_removed(
934         "extend_from_slice",
935         "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
936     );
937     store.register_removed(
938         "range_step_by_zero",
939         "`iterator.step_by(0)` panics nowadays",
940     );
941     store.register_removed(
942         "unstable_as_slice",
943         "`Vec::as_slice` has been stabilized in 1.7",
944     );
945     store.register_removed(
946         "unstable_as_mut_slice",
947         "`Vec::as_mut_slice` has been stabilized in 1.7",
948     );
949     store.register_removed(
950         "misaligned_transmute",
951         "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
952     );
953     store.register_removed(
954         "assign_ops",
955         "using compound assignment operators (e.g., `+=`) is harmless",
956     );
957     store.register_removed(
958         "if_let_redundant_pattern_matching",
959         "this lint has been changed to redundant_pattern_matching",
960     );
961     store.register_removed(
962         "unsafe_vector_initialization",
963         "the replacement suggested by this lint had substantially different behavior",
964     );
965     store.register_removed(
966         "reverse_range_loop",
967         "this lint is now included in reversed_empty_ranges",
968     );
969 }
970
971 /// Register renamed lints.
972 ///
973 /// Used in `./src/driver.rs`.
974 pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
975     for (old_name, new_name) in renamed_lints::RENAMED_LINTS {
976         ls.register_renamed(old_name, new_name);
977     }
978 }
979
980 // only exists to let the dogfood integration test works.
981 // Don't run clippy as an executable directly
982 #[allow(dead_code)]
983 fn main() {
984     panic!("Please use the cargo-clippy executable");
985 }