Bug 1617369 - Reformat recent rust changes with rustfmt r=emilio

# ignore-this-changeset

Depends on D96608

Differential Revision: https://phabricator.services.mozilla.com/D96609
This commit is contained in:
Sylvestre Ledru 2020-11-10 19:10:16 +00:00
parent c7deb74f61
commit 396275b3c3
6 changed files with 59 additions and 60 deletions

View File

@ -3769,11 +3769,7 @@ pub extern "C" fn wr_dump_display_list(
unsafe {
let gecko = CString::new("Gecko").unwrap();
let sink = CString::new(sink.into_inner()).unwrap();
__android_log_write(
4, /* info */
gecko.as_ptr(),
sink.as_ptr(),
);
__android_log_write(4 /* info */, gecko.as_ptr(), sink.as_ptr());
}
#[cfg(not(target_os = "android"))]

View File

@ -553,8 +553,15 @@ pub extern "C" fn neqo_http3conn_event(
}
}
Http3ClientEvent::DataReadable { stream_id } => Http3Event::DataReadable { stream_id },
Http3ClientEvent::Reset { stream_id, error, local } =>
Http3Event::Reset { stream_id, error, local },
Http3ClientEvent::Reset {
stream_id,
error,
local,
} => Http3Event::Reset {
stream_id,
error,
local,
},
Http3ClientEvent::PushPromise {
push_id,
request_stream_id,
@ -589,7 +596,9 @@ pub extern "C" fn neqo_http3conn_event(
Http3Event::PushDataReadable { push_id }
}
Http3ClientEvent::PushCanceled { push_id } => Http3Event::PushCanceled { push_id },
Http3ClientEvent::PushReset { push_id, error } => Http3Event::PushReset { push_id, error },
Http3ClientEvent::PushReset { push_id, error } => {
Http3Event::PushReset { push_id, error }
}
Http3ClientEvent::RequestsCreatable => Http3Event::RequestsCreatable,
Http3ClientEvent::AuthenticationNeeded => Http3Event::AuthenticationNeeded,
Http3ClientEvent::ZeroRttRejected => Http3Event::ZeroRttRejected,

View File

@ -95,9 +95,7 @@ impl HttpServer for Http3TestServer {
),
];
let path_hdr = headers
.iter()
.find(|(k, _)| k == ":path");
let path_hdr = headers.iter().find(|(k, _)| k == ":path");
match path_hdr {
Some((_, path)) if !path.is_empty() => {
qtrace!("Serve request {}", path);
@ -134,9 +132,7 @@ impl HttpServer for Http3TestServer {
.stream_reset(Error::HttpRequestRejected.code())
.unwrap();
} else if path == "/.well-known/http-opportunistic" {
let host_hdr = headers
.iter()
.find(|(k, _)| k == ":authority");
let host_hdr = headers.iter().find(|(k, _)| k == ":authority");
match host_hdr {
Some((_, host)) if !host.is_empty() => {
let mut content = b"[\"http://".to_vec();
@ -248,24 +244,21 @@ impl HttpServer for Http3TestServer {
}
if fin {
if let Some(r) = self.posts.remove(&format!("{}", request)) {
let default_ret = b"Hello World".to_vec();
request
.set_response(
&[
(String::from(":status"), String::from("200")),
(
String::from("Cache-Control"),
String::from("no-cache"),
),
(String::from("x-data-received-length"), r.to_string()),
(
String::from("content-length"),
default_ret.len().to_string(),
),
],
&default_ret,
)
.unwrap();
let default_ret = b"Hello World".to_vec();
request
.set_response(
&[
(String::from(":status"), String::from("200")),
(String::from("Cache-Control"), String::from("no-cache")),
(String::from("x-data-received-length"), r.to_string()),
(
String::from("content-length"),
default_ret.len().to_string(),
),
],
&default_ret,
)
.unwrap();
}
}
}
@ -446,22 +439,21 @@ impl ServersRunner {
let cid_mgr = Rc::new(RefCell::new(FixedConnectionIdManager::new(10)));
if http3 {
Box::new(
Http3TestServer::new(
Http3Server::new(
Instant::now(),
&[" HTTP2 Test Cert"],
PROTOCOLS,
anti_replay,
cid_mgr,
QpackSettings {
max_table_size_encoder: MAX_TABLE_SIZE,
max_table_size_decoder: MAX_TABLE_SIZE,
max_blocked_streams: MAX_BLOCKED_STREAMS,
},
).expect("We cannot make a server!")
Box::new(Http3TestServer::new(
Http3Server::new(
Instant::now(),
&[" HTTP2 Test Cert"],
PROTOCOLS,
anti_replay,
cid_mgr,
QpackSettings {
max_table_size_encoder: MAX_TABLE_SIZE,
max_table_size_decoder: MAX_TABLE_SIZE,
max_blocked_streams: MAX_BLOCKED_STREAMS,
},
)
)
.expect("We cannot make a server!"),
))
} else {
Box::new(
Server::new(

View File

@ -120,7 +120,11 @@ impl Bridge {
)
);
punt!(begin_oauth_flow, scopes: &ThinVec<nsCString>, entry_point: &nsACString);
punt!(
begin_oauth_flow,
scopes: &ThinVec<nsCString>,
entry_point: &nsACString
);
xpcom_method!(
complete_oauth_flow => CompleteOAuthFlow(

View File

@ -9,10 +9,8 @@ use crate::punt::{
use atomic_refcell::AtomicRefCell;
use fxa_client::{
device::{
Capability as FxaDeviceCapability,
CommandFetchReason,
PushSubscription as FxaPushSubscription,
Type as FxaDeviceType,
Capability as FxaDeviceCapability, CommandFetchReason,
PushSubscription as FxaPushSubscription, Type as FxaDeviceType,
},
FirefoxAccount,
};
@ -391,7 +389,8 @@ impl PuntTask {
Punt::ToJson => fxa.to_json().map(PuntResult::String),
Punt::BeginOAuthFlow(scopes, entry_point) => {
let scopes: Vec<&str> = scopes.iter().map(AsRef::as_ref).collect();
fxa.begin_oauth_flow(&scopes, &entry_point, None).map(PuntResult::String)
fxa.begin_oauth_flow(&scopes, &entry_point, None)
.map(PuntResult::String)
}
Punt::CompleteOAuthFlow(code, state) => fxa
.complete_oauth_flow(&code, &state)
@ -451,7 +450,9 @@ impl PuntTask {
Punt::HandlePushMessage(payload) => fxa
.handle_push_message(&payload)
.map(PuntResult::json_stringify),
Punt::PollDeviceCommands => fxa.poll_device_commands(CommandFetchReason::Poll).map(PuntResult::json_stringify),
Punt::PollDeviceCommands => fxa
.poll_device_commands(CommandFetchReason::Poll)
.map(PuntResult::json_stringify),
Punt::SendSingleTab(target_id, title, url) => fxa
.send_tab(&target_id, &title, &url)
.map(|_| PuntResult::Null),

View File

@ -30,17 +30,14 @@ pub(crate) mod __glean_metric_maps {
pub static TIMESPAN_MAP: Lazy<HashMap<MetricId, &Lazy<TimespanMetric>>> =
Lazy::new(HashMap::new);
pub static COUNTER_MAP: Lazy<HashMap<MetricId, &Lazy<CounterMetric>>> =
Lazy::new(HashMap::new);
pub static COUNTER_MAP: Lazy<HashMap<MetricId, &Lazy<CounterMetric>>> = Lazy::new(HashMap::new);
pub static BOOLEAN_MAP: Lazy<HashMap<MetricId, &Lazy<BooleanMetric>>> =
Lazy::new(HashMap::new);
pub static BOOLEAN_MAP: Lazy<HashMap<MetricId, &Lazy<BooleanMetric>>> = Lazy::new(HashMap::new);
pub static DATETIME_MAP: Lazy<HashMap<MetricId, &Lazy<DatetimeMetric>>> =
Lazy::new(HashMap::new);
pub static STRING_MAP: Lazy<HashMap<MetricId, &Lazy<StringMetric>>> =
Lazy::new(HashMap::new);
pub static STRING_MAP: Lazy<HashMap<MetricId, &Lazy<StringMetric>>> = Lazy::new(HashMap::new);
pub static MEMORY_DISTRIBUTION_MAP: Lazy<HashMap<MetricId, &Lazy<MemoryDistributionMetric>>> =
Lazy::new(HashMap::new);