mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Replace the lazy_static crate with std::sync::LazyLock in components/net (#33046)
* replace in net/fetch/methods.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace in net/hosts.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace in net/async_runtime.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace in net/tests/main.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * remove lazy_static crate from components/net Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> --------- Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
This commit is contained in:
parent
6be99241c6
commit
65f90ff1fd
6 changed files with 15 additions and 26 deletions
|
@ -8,13 +8,10 @@ use std::env;
|
|||
use std::fs::File;
|
||||
use std::io::{BufReader, Read};
|
||||
use std::net::{IpAddr, Ipv4Addr};
|
||||
use std::sync::Mutex;
|
||||
use std::sync::{LazyLock, Mutex};
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
lazy_static! {
|
||||
static ref HOST_TABLE: Mutex<Option<HashMap<String, IpAddr>>> = Mutex::new(create_host_table());
|
||||
}
|
||||
static HOST_TABLE: LazyLock<Mutex<Option<HashMap<String, IpAddr>>>> =
|
||||
LazyLock::new(|| Mutex::new(create_host_table()));
|
||||
|
||||
fn create_host_table() -> Option<HashMap<String, IpAddr>> {
|
||||
let path = env::var_os("HOST_FILE")?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue