Skip to content

Commit

Permalink
clippy_lints: Replace lazy_static with SyncLazy
Browse files Browse the repository at this point in the history
  • Loading branch information
phansch committed Oct 6, 2020
1 parent 9b4ceee commit da57a16
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion clippy_lints/Cargo.toml
Expand Up @@ -20,7 +20,6 @@ edition = "2018"
cargo_metadata = "0.11.1"
if_chain = "1.0.0"
itertools = "0.9"
lazy_static = "1.0.2"
pulldown-cmark = { version = "0.8", default-features = false }
quine-mc_cluskey = "0.2.2"
regex-syntax = "0.6"
Expand Down
1 change: 1 addition & 0 deletions clippy_lints/src/lib.rs
Expand Up @@ -7,6 +7,7 @@
#![feature(crate_visibility_modifier)]
#![feature(drain_filter)]
#![feature(in_band_lifetimes)]
#![feature(once_cell)]
#![feature(or_patterns)]
#![feature(rustc_private)]
#![feature(stmt_expr_attributes)]
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/macro_use.rs
Expand Up @@ -18,9 +18,9 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// ```rust,ignore
/// #[macro_use]
/// use lazy_static;
/// use some_macro;
/// ```
pub MACRO_USE_IMPORTS,
pedantic,
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/utils/conf.rs
Expand Up @@ -2,10 +2,10 @@

#![deny(clippy::missing_docs_in_private_items)]

use lazy_static::lazy_static;
use rustc_ast::ast::{LitKind, MetaItemKind, NestedMetaItem};
use rustc_span::source_map;
use source_map::Span;
use std::lazy::SyncLazy;
use std::path::{Path, PathBuf};
use std::sync::Mutex;
use std::{env, fmt, fs, io};
Expand Down Expand Up @@ -54,9 +54,8 @@ impl From<io::Error> for Error {
}
}

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

macro_rules! define_Conf {
($(#[$doc:meta] ($config:ident, $config_str:literal: $Ty:ty, $default:expr),)+) => {
Expand All @@ -82,6 +81,7 @@ macro_rules! define_Conf {
use serde::Deserialize;
pub fn deserialize<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<$Ty, D::Error> {
use super::super::{ERRORS, Error};

Ok(
<$Ty>::deserialize(deserializer).unwrap_or_else(|e| {
ERRORS
Expand Down

0 comments on commit da57a16

Please sign in to comment.