diff options
author | Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> | 2024-08-14 21:15:55 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-14 12:15:55 +0000 |
commit | 65f90ff1fd82758aa7644ada7bb75d34291c363f (patch) | |
tree | dbd1657dab933496904a676fdb5c830369b60f1b /components/net/fetch | |
parent | 6be99241c64bb5c8c4df6be3c37a5f53829cd499 (diff) | |
download | servo-65f90ff1fd82758aa7644ada7bb75d34291c363f.tar.gz servo-65f90ff1fd82758aa7644ada7bb75d34291c363f.zip |
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>
Diffstat (limited to 'components/net/fetch')
-rw-r--r-- | components/net/fetch/methods.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index 7faf3529804..06672e41fe1 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -7,7 +7,7 @@ use std::fs::File; use std::io::{self, BufReader, Seek, SeekFrom}; use std::ops::Bound; use std::sync::atomic::Ordering; -use std::sync::{Arc, Mutex}; +use std::sync::{Arc, LazyLock, Mutex}; use std::{mem, str}; use base64::engine::general_purpose; @@ -19,7 +19,6 @@ use headers::{AccessControlExposeHeaders, ContentType, HeaderMapExt, Range}; use http::header::{self, HeaderMap, HeaderName}; use http::{Method, StatusCode}; use ipc_channel::ipc::{self, IpcReceiver}; -use lazy_static::lazy_static; use log::{debug, warn}; use mime::{self, Mime}; use net_traits::blob_url_store::{parse_blob_url, BlobURLStoreError}; @@ -53,10 +52,8 @@ use crate::http_loader::{ use crate::local_directory_listing; use crate::subresource_integrity::is_response_integrity_valid; -lazy_static! { - static ref X_CONTENT_TYPE_OPTIONS: HeaderName = - HeaderName::from_static("x-content-type-options"); -} +static X_CONTENT_TYPE_OPTIONS: LazyLock<HeaderName> = + LazyLock::new(|| HeaderName::from_static("x-content-type-options")); pub type Target<'a> = &'a mut (dyn FetchTaskTarget + Send); |