Remove lint for ONCE_INIT

ONCE_INIT will be deprecated in rust 1.38.0
This commit is contained in:
Lzu Tao 2019-07-06 12:30:11 +07:00
parent 3a76bea04b
commit 481499101b
2 changed files with 1 additions and 10 deletions

View file

@ -56,9 +56,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ReplaceConsts {
} }
} }
const REPLACEMENTS: [([&str; 3], &str); 25] = [ const REPLACEMENTS: [([&str; 3], &str); 24] = [
// Once
(["core", "sync", "ONCE_INIT"], "Once::new()"),
// Min // Min
(["core", "isize", "MIN"], "isize::min_value()"), (["core", "isize", "MIN"], "isize::min_value()"),
(["core", "i8", "MIN"], "i8::min_value()"), (["core", "i8", "MIN"], "i8::min_value()"),

View file

@ -4,14 +4,9 @@
#![deny(clippy::replace_consts)] #![deny(clippy::replace_consts)]
use std::sync::atomic::*; use std::sync::atomic::*;
use std::sync::Once;
#[rustfmt::skip] #[rustfmt::skip]
fn bad() { fn bad() {
#[allow(deprecated, unused_imports)]
use std::sync::ONCE_INIT;
// Once
{ let foo = ONCE_INIT; };
// Min // Min
{ let foo = std::isize::MIN; }; { let foo = std::isize::MIN; };
{ let foo = std::i8::MIN; }; { let foo = std::i8::MIN; };
@ -42,8 +37,6 @@ fn bad() {
#[rustfmt::skip] #[rustfmt::skip]
fn good() { fn good() {
// Once
{ let foo = Once::new(); };
// Atomic // Atomic
{ let foo = AtomicBool::new(false); }; { let foo = AtomicBool::new(false); };
{ let foo = AtomicIsize::new(0); }; { let foo = AtomicIsize::new(0); };