about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEduardo Broto <ebroto@tutanota.com>2020-10-23 22:16:59 +0200
committerEduardo Broto <ebroto@tutanota.com>2020-10-23 22:16:59 +0200
commitcdb555f4fcdb57741ffb59bd2b0e66af69ea0a85 (patch)
tree5c9c37427427a7d7b95dc090c560f006a9b92efe /src
parentfcde7683fe7ca10c83e5bc17f0969d2284affcd2 (diff)
downloadrust-cdb555f4fcdb57741ffb59bd2b0e66af69ea0a85.tar.gz
rust-cdb555f4fcdb57741ffb59bd2b0e66af69ea0a85.zip
Merge commit 'bf1c6f9871f430e284b17aa44059e0d0395e28a6' into clippyup
Diffstat (limited to 'src')
-rw-r--r--src/driver.rs17
-rw-r--r--src/lintlist/mod.rs34
2 files changed, 36 insertions, 15 deletions
diff --git a/src/driver.rs b/src/driver.rs
index 805828eece1..cc71cc66b92 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)]
@@ -17,9 +18,9 @@ use rustc_interface::interface;
 use rustc_middle::ty::TyCtxt;
 use rustc_tools_util::VersionInfo;
 
-use lazy_static::lazy_static;
 use std::borrow::Cow;
 use std::env;
+use std::lazy::SyncLazy;
 use std::ops::Deref;
 use std::panic;
 use std::path::{Path, PathBuf};
@@ -230,13 +231,11 @@ You can use tool lints to allow or deny lints from your code, eg.:
 
 const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust-clippy/issues/new";
 
-lazy_static! {
-    static ref ICE_HOOK: Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static> = {
-        let hook = panic::take_hook();
-        panic::set_hook(Box::new(|info| report_clippy_ice(info, BUG_REPORT_URL)));
-        hook
-    };
-}
+static ICE_HOOK: SyncLazy<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> = SyncLazy::new(|| {
+    let hook = panic::take_hook();
+    panic::set_hook(Box::new(|info| report_clippy_ice(info, BUG_REPORT_URL)));
+    hook
+});
 
 fn report_clippy_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
     // Invoke our ICE handler, which prints the actual panic message and optionally a backtrace
@@ -295,7 +294,7 @@ fn toolchain_path(home: Option<String>, toolchain: Option<String>) -> Option<Pat
 
 pub fn main() {
     rustc_driver::init_rustc_env_logger();
-    lazy_static::initialize(&ICE_HOOK);
+    SyncLazy::force(&ICE_HOOK);
     exit(rustc_driver::catch_with_exit_code(move || {
         let mut orig_args: Vec<String> = env::args().collect();
 
diff --git a/src/lintlist/mod.rs b/src/lintlist/mod.rs
index ce3d0efab3a..6301d623a2b 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",
@@ -1180,6 +1181,13 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
         module: "swap",
     },
     Lint {
+        name: "manual_unwrap_or",
+        group: "complexity",
+        desc: "finds patterns that can be encoded more concisely with `Option::unwrap_or`",
+        deprecation: None,
+        module: "manual_unwrap_or",
+    },
+    Lint {
         name: "many_single_char_names",
         group: "style",
         desc: "too many single character bindings",
@@ -1845,6 +1853,13 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
         module: "ptr",
     },
     Lint {
+        name: "ptr_eq",
+        group: "style",
+        desc: "use `std::ptr::eq` when comparing raw pointers",
+        deprecation: None,
+        module: "ptr_eq",
+    },
+    Lint {
         name: "ptr_offset_with_cast",
         group: "complexity",
         desc: "unneeded pointer offset cast",
@@ -1999,6 +2014,13 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
         module: "map_unit_fn",
     },
     Lint {
+        name: "result_unit_err",
+        group: "style",
+        desc: "public function returning `Result` with an `Err` type of `()`",
+        deprecation: None,
+        module: "functions",
+    },
+    Lint {
         name: "reversed_empty_ranges",
         group: "correctness",
         desc: "reversing the limits of range expressions, resulting in empty ranges",
@@ -2817,6 +2839,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`
-}
+});