lintlist.rs: Replace lazy_static with once_cell

Follow-up to https://github.com/rust-lang/rust-clippy/pull/6120
This commit is contained in:
Philipp Hansch 2020-10-12 16:50:34 +02:00
parent 92783e39de
commit c5774f94ef
No known key found for this signature in database
GPG Key ID: 188FE733728652B1
3 changed files with 9 additions and 7 deletions

View File

@ -29,7 +29,7 @@ pub fn run(update_mode: UpdateMode) {
false, false,
update_mode == UpdateMode::Change, update_mode == UpdateMode::Change,
|| { || {
format!("pub static ref ALL_LINTS: Vec<Lint> = vec!{:#?};", sorted_usable_lints) format!("vec!{:#?}", sorted_usable_lints)
.lines() .lines()
.map(ToString::to_string) .map(ToString::to_string)
.collect::<Vec<_>>() .collect::<Vec<_>>()

View File

@ -1,4 +1,5 @@
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(once_cell)]
#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![cfg_attr(feature = "deny-warnings", deny(warnings))]
// warn on lints, that are included in `rust-lang/rust`s bootstrap // warn on lints, that are included in `rust-lang/rust`s bootstrap
#![warn(rust_2018_idioms, unused_lifetimes)] #![warn(rust_2018_idioms, unused_lifetimes)]

View File

@ -1,15 +1,16 @@
//! This file is managed by `cargo dev update_lints`. Do not edit. //! This file is managed by `cargo dev update_lints`. Do not edit or format this file.
use lazy_static::lazy_static; use std::lazy::SyncLazy;
pub mod lint; pub mod lint;
pub use lint::Level; pub use lint::Level;
pub use lint::Lint; pub use lint::Lint;
pub use lint::LINT_LEVELS; pub use lint::LINT_LEVELS;
lazy_static! { #[rustfmt::skip]
pub static ALL_LINTS: SyncLazy<Vec<Lint>> = SyncLazy::new(|| {
// begin lint list, do not remove this comment, its used in `update_lints` // begin lint list, do not remove this comment, its used in `update_lints`
pub static ref ALL_LINTS: Vec<Lint> = vec![ vec![
Lint { Lint {
name: "absurd_extreme_comparisons", name: "absurd_extreme_comparisons",
group: "correctness", group: "correctness",
@ -2831,6 +2832,6 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
deprecation: None, deprecation: None,
module: "methods", module: "methods",
}, },
]; ]
// end lint list, do not remove this comment, its used in `update_lints` // end lint list, do not remove this comment, its used in `update_lints`
} });