mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting * Reformat all imports
This commit is contained in:
parent
413da4ca69
commit
aad2dccc9c
802 changed files with 6861 additions and 6395 deletions
|
@ -2,7 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::fetch;
|
||||
use std::ops::Deref;
|
||||
|
||||
use headers::{ContentType, HeaderMapExt};
|
||||
use hyper_serde::Serde;
|
||||
use mime::{self, Mime};
|
||||
|
@ -10,7 +11,8 @@ use net_traits::request::{Origin, Referrer, Request};
|
|||
use net_traits::response::{HttpsState, ResponseBody};
|
||||
use net_traits::{FetchMetadata, FilteredMetadata, NetworkError};
|
||||
use servo_url::ServoUrl;
|
||||
use std::ops::Deref;
|
||||
|
||||
use crate::fetch;
|
||||
|
||||
#[cfg(test)]
|
||||
fn assert_parse(
|
||||
|
|
|
@ -4,24 +4,23 @@
|
|||
|
||||
#![cfg(not(target_os = "windows"))]
|
||||
|
||||
use crate::fetch_with_context;
|
||||
use crate::fetch_with_cors_cache;
|
||||
use crate::http_loader::{expect_devtools_http_request, expect_devtools_http_response};
|
||||
use crate::{
|
||||
create_embedder_proxy, fetch, make_server, make_ssl_server, new_fetch_context,
|
||||
DEFAULT_USER_AGENT,
|
||||
};
|
||||
use std::fs;
|
||||
use std::iter::FromIterator;
|
||||
use std::path::Path;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::{Arc, Mutex, Weak};
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use crossbeam_channel::{unbounded, Sender};
|
||||
use devtools_traits::HttpRequest as DevtoolsHttpRequest;
|
||||
use devtools_traits::HttpResponse as DevtoolsHttpResponse;
|
||||
use headers::StrictTransportSecurity;
|
||||
use headers::{AccessControlAllowCredentials, AccessControlAllowHeaders, AccessControlAllowOrigin};
|
||||
use headers::{AccessControlAllowMethods, AccessControlMaxAge, HeaderMapExt};
|
||||
use headers::{CacheControl, ContentLength, ContentType, Expires, LastModified, Pragma, UserAgent};
|
||||
use devtools_traits::{HttpRequest as DevtoolsHttpRequest, HttpResponse as DevtoolsHttpResponse};
|
||||
use headers::{
|
||||
AccessControlAllowCredentials, AccessControlAllowHeaders, AccessControlAllowMethods,
|
||||
AccessControlAllowOrigin, AccessControlMaxAge, CacheControl, ContentLength, ContentType,
|
||||
Expires, HeaderMapExt, LastModified, Pragma, StrictTransportSecurity, UserAgent,
|
||||
};
|
||||
use http::header::{self, HeaderMap, HeaderName, HeaderValue};
|
||||
use http::{Method, StatusCode};
|
||||
use hyper::Body;
|
||||
use hyper::{Request as HyperRequest, Response as HyperResponse};
|
||||
use hyper::{Body, Request as HyperRequest, Response as HyperResponse};
|
||||
use mime::{self, Mime};
|
||||
use msg::constellation_msg::TEST_PIPELINE_ID;
|
||||
use net::fetch::cors_cache::CorsCache;
|
||||
|
@ -41,15 +40,15 @@ use net_traits::{
|
|||
};
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use std::fs;
|
||||
use std::iter::FromIterator;
|
||||
use std::path::Path;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::{Arc, Mutex, Weak};
|
||||
use std::time::{Duration, SystemTime};
|
||||
use tokio_test::block_on;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::http_loader::{expect_devtools_http_request, expect_devtools_http_response};
|
||||
use crate::{
|
||||
create_embedder_proxy, fetch, fetch_with_context, fetch_with_cors_cache, make_server,
|
||||
make_ssl_server, new_fetch_context, DEFAULT_USER_AGENT,
|
||||
};
|
||||
|
||||
// TODO write a struct that impls Handler for storing test values
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::env;
|
||||
|
||||
use url::Url;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::create_embedder_proxy;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use embedder_traits::FilterPattern;
|
||||
use ipc_channel::ipc;
|
||||
use net::filemanager_thread::FileManager;
|
||||
|
@ -12,10 +16,8 @@ use net_traits::filemanager_thread::{
|
|||
FileManagerThreadError, FileManagerThreadMsg, ReadFileProgress,
|
||||
};
|
||||
use servo_config::set_pref;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::create_embedder_proxy;
|
||||
|
||||
#[test]
|
||||
fn test_filemanager() {
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use net::hsts::{HstsEntry, HstsList};
|
||||
use net_traits::IncludeSubdomains;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[test]
|
||||
fn test_hsts_entry_is_not_expired_when_it_has_no_timestamp() {
|
||||
|
|
|
@ -4,15 +4,19 @@
|
|||
|
||||
#![cfg(not(target_os = "windows"))]
|
||||
|
||||
use crate::fetch;
|
||||
use crate::fetch_with_context;
|
||||
use crate::make_server;
|
||||
use crate::new_fetch_context;
|
||||
use std::collections::HashMap;
|
||||
use std::io::Write;
|
||||
use std::str;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::time::Duration;
|
||||
|
||||
use cookie_rs::Cookie as CookiePair;
|
||||
use crossbeam_channel::{unbounded, Receiver};
|
||||
use devtools_traits::HttpRequest as DevtoolsHttpRequest;
|
||||
use devtools_traits::HttpResponse as DevtoolsHttpResponse;
|
||||
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg, NetworkEvent};
|
||||
use devtools_traits::{
|
||||
ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest,
|
||||
HttpResponse as DevtoolsHttpResponse, NetworkEvent,
|
||||
};
|
||||
use flate2::write::{DeflateEncoder, GzEncoder};
|
||||
use flate2::Compression;
|
||||
use headers::authorization::Basic;
|
||||
|
@ -22,8 +26,7 @@ use headers::{
|
|||
use http::header::{self, HeaderMap, HeaderValue};
|
||||
use http::uri::Authority;
|
||||
use http::{Method, StatusCode};
|
||||
use hyper::Body;
|
||||
use hyper::{Request as HyperRequest, Response as HyperResponse};
|
||||
use hyper::{Body, Request as HyperRequest, Response as HyperResponse};
|
||||
use ipc_channel::ipc;
|
||||
use ipc_channel::router::ROUTER;
|
||||
use msg::constellation_msg::TEST_PIPELINE_ID;
|
||||
|
@ -39,12 +42,8 @@ use net_traits::request::{
|
|||
use net_traits::response::ResponseBody;
|
||||
use net_traits::{CookieSource, NetworkError, ReferrerPolicy};
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use std::collections::HashMap;
|
||||
use std::io::Write;
|
||||
use std::str;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::{fetch, fetch_with_context, make_server, new_fetch_context};
|
||||
|
||||
fn mock_origin() -> ImmutableOrigin {
|
||||
ServoUrl::parse("http://servo.org").unwrap().origin()
|
||||
|
|
|
@ -19,6 +19,12 @@ mod resource_thread;
|
|||
mod subresource_integrity;
|
||||
|
||||
use core::convert::Infallible;
|
||||
use std::fs::File;
|
||||
use std::io::{self, BufReader};
|
||||
use std::net::TcpListener as StdTcpListener;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, Mutex, Weak};
|
||||
|
||||
use crossbeam_channel::{unbounded, Sender};
|
||||
use devtools_traits::DevtoolsControlMsg;
|
||||
use embedder_traits::{EmbedderProxy, EventLoopWaker};
|
||||
|
@ -42,13 +48,7 @@ use rustls::{self, Certificate, PrivateKey};
|
|||
use rustls_pemfile::{certs, pkcs8_private_keys};
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use servo_url::ServoUrl;
|
||||
use std::fs::File;
|
||||
use std::io::{self, BufReader};
|
||||
use std::net::TcpListener as StdTcpListener;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, Mutex, Weak};
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
use tokio::runtime::{Builder, Runtime};
|
||||
use tokio_rustls::{self, TlsAcceptor};
|
||||
use tokio_stream::wrappers::TcpListenerStream;
|
||||
|
|
|
@ -2,14 +2,15 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use mime::{self, Mime};
|
||||
use net::mime_classifier::{ApacheBugFlag, MimeClassifier, Mp4Matcher, NoSniffFlag};
|
||||
use net_traits::LoadContext;
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::{self, Read};
|
||||
use std::path::{self, PathBuf};
|
||||
|
||||
use mime::{self, Mime};
|
||||
use net::mime_classifier::{ApacheBugFlag, MimeClassifier, Mp4Matcher, NoSniffFlag};
|
||||
use net_traits::LoadContext;
|
||||
|
||||
fn read_file(path: &path::Path) -> io::Result<Vec<u8>> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut buffer = Vec::new();
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::create_embedder_proxy;
|
||||
use std::net::IpAddr;
|
||||
|
||||
use ipc_channel::ipc;
|
||||
use net::connector::CACertificates;
|
||||
use net::resource_thread::new_core_resource_thread;
|
||||
|
@ -10,7 +11,8 @@ use net::test::parse_hostsfile;
|
|||
use net_traits::CoreResourceMsg;
|
||||
use profile_traits::mem::ProfilerChan as MemProfilerChan;
|
||||
use profile_traits::time::ProfilerChan;
|
||||
use std::net::IpAddr;
|
||||
|
||||
use crate::create_embedder_proxy;
|
||||
|
||||
fn ip(s: &str) -> IpAddr {
|
||||
s.parse().unwrap()
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use net::subresource_integrity::{get_prioritized_hash_function, get_strongest_metadata, SriEntry};
|
||||
use net::subresource_integrity::{is_response_integrity_valid, parsed_metadata};
|
||||
use net::subresource_integrity::{
|
||||
get_prioritized_hash_function, get_strongest_metadata, is_response_integrity_valid,
|
||||
parsed_metadata, SriEntry,
|
||||
};
|
||||
use net_traits::response::{Response, ResponseBody};
|
||||
use net_traits::{ResourceFetchTiming, ResourceTimingType};
|
||||
use servo_url::ServoUrl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue