Browse Source

Replace deprecated ATOMIC_USIZE_INIT by AtomicUsize::new

This requires at least rustc 1.24.0 as only then the function
became stably const-fn.
est31 7 years ago
parent
commit
03c43b29bd
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/origin.rs

+ 2 - 2
src/origin.rs

@@ -10,7 +10,7 @@
 use host::Host;
 use host::Host;
 use idna::domain_to_unicode;
 use idna::domain_to_unicode;
 use parser::default_port;
 use parser::default_port;
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+use std::sync::atomic::{AtomicUsize, Ordering};
 use Url;
 use Url;
 
 
 pub fn url_origin(url: &Url) -> Origin {
 pub fn url_origin(url: &Url) -> Origin {
@@ -76,7 +76,7 @@ impl HeapSizeOf for Origin {
 impl Origin {
 impl Origin {
     /// Creates a new opaque origin that is only equal to itself.
     /// Creates a new opaque origin that is only equal to itself.
     pub fn new_opaque() -> Origin {
     pub fn new_opaque() -> Origin {
-        static COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
+        static COUNTER: AtomicUsize = AtomicUsize::new(0);
         Origin::Opaque(OpaqueOrigin(COUNTER.fetch_add(1, Ordering::SeqCst)))
         Origin::Opaque(OpaqueOrigin(COUNTER.fetch_add(1, Ordering::SeqCst)))
     }
     }