Skip to content

Commit c5774f9

Browse files
committed
lintlist.rs: Replace lazy_static with once_cell
Follow-up to rust-lang/rust-clippy#6120
1 parent 92783e3 commit c5774f9

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

clippy_dev/src/update_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn run(update_mode: UpdateMode) {
2929
false,
3030
update_mode == UpdateMode::Change,
3131
|| {
32-
format!("pub static ref ALL_LINTS: Vec<Lint> = vec!{:#?};", sorted_usable_lints)
32+
format!("vec!{:#?}", sorted_usable_lints)
3333
.lines()
3434
.map(ToString::to_string)
3535
.collect::<Vec<_>>()

src/driver.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(rustc_private)]
2+
#![feature(once_cell)]
23
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
34
// warn on lints, that are included in `rust-lang/rust`s bootstrap
45
#![warn(rust_2018_idioms, unused_lifetimes)]

src/lintlist/mod.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
//! This file is managed by `cargo dev update_lints`. Do not edit.
1+
//! This file is managed by `cargo dev update_lints`. Do not edit or format this file.
22
3-
use lazy_static::lazy_static;
3+
use std::lazy::SyncLazy;
44

55
pub mod lint;
66
pub use lint::Level;
77
pub use lint::Lint;
88
pub use lint::LINT_LEVELS;
99

10-
lazy_static! {
10+
#[rustfmt::skip]
11+
pub static ALL_LINTS: SyncLazy<Vec<Lint>> = SyncLazy::new(|| {
1112
// begin lint list, do not remove this comment, it’s used in `update_lints`
12-
pub static ref ALL_LINTS: Vec<Lint> = vec![
13+
vec![
1314
Lint {
1415
name: "absurd_extreme_comparisons",
1516
group: "correctness",
@@ -2831,6 +2832,6 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
28312832
deprecation: None,
28322833
module: "methods",
28332834
},
2834-
];
2835+
]
28352836
// end lint list, do not remove this comment, it’s used in `update_lints`
2836-
}
2837+
});

0 commit comments

Comments
 (0)