Skip to content

Commit da57a16

Browse files
committed
clippy_lints: Replace lazy_static with SyncLazy
1 parent 9b4ceee commit da57a16

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

clippy_lints/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ edition = "2018"
2020
cargo_metadata = "0.11.1"
2121
if_chain = "1.0.0"
2222
itertools = "0.9"
23-
lazy_static = "1.0.2"
2423
pulldown-cmark = { version = "0.8", default-features = false }
2524
quine-mc_cluskey = "0.2.2"
2625
regex-syntax = "0.6"

clippy_lints/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#![feature(crate_visibility_modifier)]
88
#![feature(drain_filter)]
99
#![feature(in_band_lifetimes)]
10+
#![feature(once_cell)]
1011
#![feature(or_patterns)]
1112
#![feature(rustc_private)]
1213
#![feature(stmt_expr_attributes)]

clippy_lints/src/macro_use.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ declare_clippy_lint! {
1818
/// **Known problems:** None.
1919
///
2020
/// **Example:**
21-
/// ```rust
21+
/// ```rust,ignore
2222
/// #[macro_use]
23-
/// use lazy_static;
23+
/// use some_macro;
2424
/// ```
2525
pub MACRO_USE_IMPORTS,
2626
pedantic,

clippy_lints/src/utils/conf.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
33
#![deny(clippy::missing_docs_in_private_items)]
44

5-
use lazy_static::lazy_static;
65
use rustc_ast::ast::{LitKind, MetaItemKind, NestedMetaItem};
76
use rustc_span::source_map;
87
use source_map::Span;
8+
use std::lazy::SyncLazy;
99
use std::path::{Path, PathBuf};
1010
use std::sync::Mutex;
1111
use std::{env, fmt, fs, io};
@@ -54,9 +54,8 @@ impl From<io::Error> for Error {
5454
}
5555
}
5656

57-
lazy_static! {
58-
static ref ERRORS: Mutex<Vec<Error>> = Mutex::new(Vec::new());
59-
}
57+
/// Vec of errors that might be collected during config toml parsing
58+
static ERRORS: SyncLazy<Mutex<Vec<Error>>> = SyncLazy::new(|| Mutex::new(Vec::new()));
6059

6160
macro_rules! define_Conf {
6261
($(#[$doc:meta] ($config:ident, $config_str:literal: $Ty:ty, $default:expr),)+) => {
@@ -82,6 +81,7 @@ macro_rules! define_Conf {
8281
use serde::Deserialize;
8382
pub fn deserialize<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<$Ty, D::Error> {
8483
use super::super::{ERRORS, Error};
84+
8585
Ok(
8686
<$Ty>::deserialize(deserializer).unwrap_or_else(|e| {
8787
ERRORS

0 commit comments

Comments
 (0)