]> git.proxmox.com Git - rustc.git/blobdiff - src/vendor/clap/src/macros.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / vendor / clap / src / macros.rs
index 9d675aa0f5907ba43c9c94660838c86b6283a968..db8ea2f0a3849b3bfebfec5b03240a7de31ab01b 100644 (file)
@@ -422,26 +422,29 @@ macro_rules! crate_authors {
         use std::sync::{ONCE_INIT, Once};
 
         #[allow(missing_copy_implementations)]
-        #[allow(non_camel_case_types)]
         #[allow(dead_code)]
-        struct CARGO_AUTHORS {__private_field: ()}
-        static CARGO_AUTHORS: CARGO_AUTHORS = CARGO_AUTHORS {__private_field: ()};
+        struct CargoAuthors { __private_field: () };
 
-        impl Deref for CARGO_AUTHORS {
-            type Target = String;
+        impl Deref for CargoAuthors {
+            type Target = str;
 
             #[allow(unsafe_code)]
-            fn deref<'a>(&'a self) -> &'a String {
+            fn deref(&self) -> &'static str {
+                static ONCE: Once = ONCE_INIT;
+                static mut VALUE: *const String = 0 as *const String;
+
                 unsafe {
-                    static mut LAZY: (*const String, Once) = (0 as *const String, ONCE_INIT);
+                    ONCE.call_once(|| {
+                        let s = env!("CARGO_PKG_AUTHORS").replace(':', $sep);
+                        VALUE = Box::into_raw(Box::new(s));
+                    });
 
-                    LAZY.1.call_once(|| LAZY.0 = Box::into_raw(Box::new(env!("CARGO_PKG_AUTHORS").replace(':', $sep))));
-                    &*LAZY.0
+                    &(*VALUE)[..]
                 }
             }
         }
 
-        &CARGO_AUTHORS[..]
+        &*CargoAuthors { __private_field: () }
     }};
     () => {
         env!("CARGO_PKG_AUTHORS")