Skip to content

Commit d4551d8

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

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

clippy_dev/src/update_lints.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
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+
#![rustfmt::skip]
4+
5+
use std::lazy::SyncLazy;
46

57
pub mod lint;
68
pub use lint::Level;
79
pub use lint::Lint;
810
pub use lint::LINT_LEVELS;
911

10-
lazy_static! {
12+
pub static ALL_LINTS: SyncLazy<Vec<Lint>> = SyncLazy::new(|| {
1113
// begin lint list, do not remove this comment, it’s used in `update_lints`
12-
pub static ref ALL_LINTS: Vec<Lint> = vec![
14+
vec![
1315
Lint {
1416
name: "absurd_extreme_comparisons",
1517
group: "correctness",
@@ -2831,6 +2833,6 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
28312833
deprecation: None,
28322834
module: "methods",
28332835
},
2834-
];
2836+
]
28352837
// end lint list, do not remove this comment, it’s used in `update_lints`
2836-
}
2838+
});

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
22
// warn on lints, that are included in `rust-lang/rust`s bootstrap
33
#![warn(rust_2018_idioms, unused_lifetimes)]
4+
#![feature(once_cell)]
45

56
use rustc_tools_util::VersionInfo;
67
use std::env;

0 commit comments

Comments
 (0)