mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
clippy_lints: Replace lazy_static with SyncLazy
This commit is contained in:
parent
9b4ceee593
commit
da57a16872
@ -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"
|
||||
|
@ -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)]
|
||||
|
@ -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,
|
||||
|
@ -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};
|
||||
@ -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),)+) => {
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user