From dd5945e9324f01832bd86c34cd32e3e4fd3a021a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 2 Mar 2021 15:35:36 +0000 Subject: [PATCH] Bug 1617369 - Reformat recent rust changes with rustfmt r=emilio Updated with rustfmt 1.4.18-stable (8157a3f 2020-07-15) # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D106921 --- gfx/webrender_bindings/src/bindings.rs | 5 +- netwerk/socket/neqo_glue/src/lib.rs | 4 +- .../manager/ssl/osclientcerts/src/manager.rs | 138 +++++++++--------- 3 files changed, 74 insertions(+), 73 deletions(-) diff --git a/gfx/webrender_bindings/src/bindings.rs b/gfx/webrender_bindings/src/bindings.rs index 20511922fec5..836e67b68665 100644 --- a/gfx/webrender_bindings/src/bindings.rs +++ b/gfx/webrender_bindings/src/bindings.rs @@ -1238,10 +1238,7 @@ extern "C" { fn wr_compositor_end_frame(compositor: *mut c_void); fn wr_compositor_enable_native_compositor(compositor: *mut c_void, enable: bool); fn wr_compositor_deinit(compositor: *mut c_void); - fn wr_compositor_get_capabilities( - compositor: *mut c_void, - caps: *mut CompositorCapabilities, - ); + fn wr_compositor_get_capabilities(compositor: *mut c_void, caps: *mut CompositorCapabilities); fn wr_compositor_map_tile( compositor: *mut c_void, id: NativeTileId, diff --git a/netwerk/socket/neqo_glue/src/lib.rs b/netwerk/socket/neqo_glue/src/lib.rs index d6bd7380a6b3..5b6dcce51da6 100644 --- a/netwerk/socket/neqo_glue/src/lib.rs +++ b/netwerk/socket/neqo_glue/src/lib.rs @@ -206,7 +206,7 @@ pub extern "C" fn neqo_http3conn_process_input( remote_addr: &nsACString, packet: *const ThinVec, ) -> nsresult { - let remote = match str::from_utf8(remote_addr) { + let remote = match str::from_utf8(remote_addr) { Ok(s) => match s.parse() { Ok(addr) => addr, Err(_) => return NS_ERROR_INVALID_ARG, @@ -265,7 +265,7 @@ pub extern "C" fn neqo_http3conn_get_data_to_send( Some(d) => { packet.extend_from_slice(&d); remote_addr.append(&d.destination().ip().to_string()); - *remote_port = d.destination().port(); + *remote_port = d.destination().port(); NS_OK } } diff --git a/security/manager/ssl/osclientcerts/src/manager.rs b/security/manager/ssl/osclientcerts/src/manager.rs index 05b14ec276ea..51388f06feff 100644 --- a/security/manager/ssl/osclientcerts/src/manager.rs +++ b/security/manager/ssl/osclientcerts/src/manager.rs @@ -102,77 +102,81 @@ impl ManagerProxy { let (proxy_sender, manager_receiver) = channel(); let (manager_sender, proxy_receiver) = channel(); let thread_handle = thread::Builder::new() - .name("osclientcert".into()) - .spawn(move || { - let mut real_manager = Manager::new(); - loop { - let arguments = match manager_receiver.recv() { - Ok(arguments) => arguments, - Err(e) => { - error!("error recv()ing arguments from ManagerProxy: {}", e); - break; + .name("osclientcert".into()) + .spawn(move || { + let mut real_manager = Manager::new(); + loop { + let arguments = match manager_receiver.recv() { + Ok(arguments) => arguments, + Err(e) => { + error!("error recv()ing arguments from ManagerProxy: {}", e); + break; + } + }; + let results = match arguments { + ManagerArguments::OpenSession(slot_type) => { + ManagerReturnValue::OpenSession(real_manager.open_session(slot_type)) + } + ManagerArguments::CloseSession(session_handle) => { + ManagerReturnValue::CloseSession( + real_manager.close_session(session_handle), + ) + } + ManagerArguments::CloseAllSessions(slot_type) => { + ManagerReturnValue::CloseAllSessions( + real_manager.close_all_sessions(slot_type), + ) + } + ManagerArguments::StartSearch(session, attrs) => { + ManagerReturnValue::StartSearch( + real_manager.start_search(session, &attrs), + ) + } + ManagerArguments::Search(session, max_objects) => { + ManagerReturnValue::Search(real_manager.search(session, max_objects)) + } + ManagerArguments::ClearSearch(session) => { + ManagerReturnValue::ClearSearch(real_manager.clear_search(session)) + } + ManagerArguments::GetAttributes(object_handle, attr_types) => { + ManagerReturnValue::GetAttributes( + real_manager.get_attributes(object_handle, attr_types), + ) + } + ManagerArguments::StartSign(session, key_handle, params) => { + ManagerReturnValue::StartSign( + real_manager.start_sign(session, key_handle, params), + ) + } + ManagerArguments::GetSignatureLength(session, data) => { + ManagerReturnValue::GetSignatureLength( + real_manager.get_signature_length(session, &data), + ) + } + ManagerArguments::Sign(session, data) => { + ManagerReturnValue::Sign(real_manager.sign(session, &data)) + } + ManagerArguments::Stop => { + debug!("ManagerArguments::Stop received - stopping Manager thread."); + ManagerReturnValue::Stop(Ok(())) + } + }; + let stop_after_send = match &results { + &ManagerReturnValue::Stop(_) => true, + _ => false, + }; + match manager_sender.send(results) { + Ok(()) => {} + Err(e) => { + error!("error send()ing results from Manager: {}", e); + break; + } } - }; - let results = match arguments { - ManagerArguments::OpenSession(slot_type) => { - ManagerReturnValue::OpenSession(real_manager.open_session(slot_type)) - } - ManagerArguments::CloseSession(session_handle) => { - ManagerReturnValue::CloseSession(real_manager.close_session(session_handle)) - } - ManagerArguments::CloseAllSessions(slot_type) => { - ManagerReturnValue::CloseAllSessions( - real_manager.close_all_sessions(slot_type), - ) - } - ManagerArguments::StartSearch(session, attrs) => { - ManagerReturnValue::StartSearch(real_manager.start_search(session, &attrs)) - } - ManagerArguments::Search(session, max_objects) => { - ManagerReturnValue::Search(real_manager.search(session, max_objects)) - } - ManagerArguments::ClearSearch(session) => { - ManagerReturnValue::ClearSearch(real_manager.clear_search(session)) - } - ManagerArguments::GetAttributes(object_handle, attr_types) => { - ManagerReturnValue::GetAttributes( - real_manager.get_attributes(object_handle, attr_types), - ) - } - ManagerArguments::StartSign(session, key_handle, params) => { - ManagerReturnValue::StartSign( - real_manager.start_sign(session, key_handle, params), - ) - } - ManagerArguments::GetSignatureLength(session, data) => { - ManagerReturnValue::GetSignatureLength( - real_manager.get_signature_length(session, &data), - ) - } - ManagerArguments::Sign(session, data) => { - ManagerReturnValue::Sign(real_manager.sign(session, &data)) - } - ManagerArguments::Stop => { - debug!("ManagerArguments::Stop received - stopping Manager thread."); - ManagerReturnValue::Stop(Ok(())) - } - }; - let stop_after_send = match &results { - &ManagerReturnValue::Stop(_) => true, - _ => false, - }; - match manager_sender.send(results) { - Ok(()) => {} - Err(e) => { - error!("error send()ing results from Manager: {}", e); + if stop_after_send { break; } } - if stop_after_send { - break; - } - } - }); + }); match thread_handle { Ok(thread_handle) => Ok(ManagerProxy { sender: proxy_sender,