about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hansch <dev@phansch.net>2020-10-12 16:50:34 +0200
committerPhilipp Hansch <dev@phansch.net>2020-10-12 18:19:18 +0200
commitc5774f94efd60b60fc7120ba3d6de7f79b05681b (patch)
treee908a78755bbb43c02097c39a76ec129b3ca27b3
parent92783e39de26a114389c1e45a29ccbe75698dd2a (diff)
downloadrust-c5774f94efd60b60fc7120ba3d6de7f79b05681b.tar.gz
rust-c5774f94efd60b60fc7120ba3d6de7f79b05681b.zip
lintlist.rs: Replace lazy_static with once_cell
Follow-up to https://github.com/rust-lang/rust-clippy/pull/6120
-rw-r--r--clippy_dev/src/update_lints.rs2
-rw-r--r--src/driver.rs1
-rw-r--r--src/lintlist/mod.rs13
3 files changed, 9 insertions, 7 deletions
diff --git a/clippy_dev/src/update_lints.rs b/clippy_dev/src/update_lints.rs
index a9a70929942..556b67e0b37 100644
--- a/clippy_dev/src/update_lints.rs
+++ b/clippy_dev/src/update_lints.rs
@@ -29,7 +29,7 @@ pub fn run(update_mode: UpdateMode) {
         false,
         update_mode == UpdateMode::Change,
         || {
-            format!("pub static ref ALL_LINTS: Vec<Lint> = vec!{:#?};", sorted_usable_lints)
+            format!("vec!{:#?}", sorted_usable_lints)
                 .lines()
                 .map(ToString::to_string)
                 .collect::<Vec<_>>()
diff --git a/src/driver.rs b/src/driver.rs
index 377f6d22446..c9b07855af1 100644
--- a/src/driver.rs
+++ b/src/driver.rs
@@ -1,4 +1,5 @@
 #![feature(rustc_private)]
+#![feature(once_cell)]
 #![cfg_attr(feature = "deny-warnings", deny(warnings))]
 // warn on lints, that are included in `rust-lang/rust`s bootstrap
 #![warn(rust_2018_idioms, unused_lifetimes)]
diff --git a/src/lintlist/mod.rs b/src/lintlist/mod.rs
index d0fc8f0c8a9..624223ff706 100644
--- a/src/lintlist/mod.rs
+++ b/src/lintlist/mod.rs
@@ -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 use lint::Level;
 pub use lint::Lint;
 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, it’s used in `update_lints`
-pub static ref ALL_LINTS: Vec<Lint> = vec![
+vec![
     Lint {
         name: "absurd_extreme_comparisons",
         group: "correctness",
@@ -2831,6 +2832,6 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
         deprecation: None,
         module: "methods",
     },
-];
+]
 // end lint list, do not remove this comment, it’s used in `update_lints`
-}
+});