Bug 1617369 - Reformat recent rust changes with rustfmt r=emilio
authorSylvestre Ledru <sledru@mozilla.com>
Sat, 25 Apr 2020 21:21:32 +0000
changeset 526092 08a0e1e4864c9dfeff34aa3528a550aa84a8994d
parent 526091 646b2f07e39803242f0cb0b04c17bec6f0282b10
child 526093 183a08e4e23605ba22981e9750c04f8b55ec9062
push id37350
push usernbeleuzu@mozilla.com
push dateSun, 26 Apr 2020 09:43:12 +0000
treeherdermozilla-central@21659f178a12 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1617369
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1617369 - Reformat recent rust changes with rustfmt r=emilio Done with: ./mach lint -l rustfmt --fix with rustfmt 1.4.12-stable (a828ffe 2020-03-11) # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D72527
gfx/webrender_bindings/src/bindings.rs
gfx/webrender_bindings/src/moz2d_renderer.rs
js/src/frontend/smoosh/src/lib.rs
js/src/rust/lib.rs
js/src/wasm/cranelift/src/wasm2clif.rs
media/audioipc/client/src/context.rs
media/audioipc/client/src/stream.rs
testing/mozbase/rust/mozdevice/src/lib.rs
testing/webdriver/src/server.rs
toolkit/components/bitsdownload/src/bits_interface/request.rs
toolkit/components/kvstore/src/task.rs
toolkit/components/places/bookmark_sync/src/store.rs
toolkit/components/updateagent/src/taskschd.rs
xpcom/rust/nsstring/src/conversions.rs
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -29,21 +29,20 @@ use euclid::SideOffsets2D;
 use moz2d_renderer::Moz2dBlobImageHandler;
 use nsstring::nsAString;
 use num_cpus;
 use program_cache::{remove_disk_cache, WrProgramCache};
 use rayon;
 use swgl_bindings::SwCompositor;
 use tracy_rs::register_thread_with_profiler;
 use webrender::{
-    api::units::*, api::*, set_profiler_hooks, AsyncPropertySampler, AsyncScreenshotHandle,
-    Compositor, CompositorCapabilities, CompositorConfig, DebugFlags, Device, FastHashMap,
-    NativeSurfaceId, NativeSurfaceInfo, NativeTileId, PipelineInfo, ProfilerHooks, RecordedFrameHandle, Renderer,
-    RendererOptions, RendererStats, SceneBuilderHooks, ShaderPrecacheFlags, Shaders, ThreadListener, UploadMethod,
-    VertexUsageHint, WrShaders,
+    api::units::*, api::*, set_profiler_hooks, AsyncPropertySampler, AsyncScreenshotHandle, Compositor,
+    CompositorCapabilities, CompositorConfig, DebugFlags, Device, FastHashMap, NativeSurfaceId, NativeSurfaceInfo,
+    NativeTileId, PipelineInfo, ProfilerHooks, RecordedFrameHandle, Renderer, RendererOptions, RendererStats,
+    SceneBuilderHooks, ShaderPrecacheFlags, Shaders, ThreadListener, UploadMethod, VertexUsageHint, WrShaders,
 };
 
 #[cfg(target_os = "macos")]
 use core_foundation::string::CFString;
 #[cfg(target_os = "macos")]
 use core_graphics::font::CGFont;
 
 extern "C" {
@@ -1990,17 +1989,17 @@ pub extern "C" fn wr_resource_updates_ad
     key: WrFontKey,
     bytes: &mut WrVecU8,
     index: u32,
 ) {
     txn.add_raw_font(key, bytes.flush_into_vec(), index);
 }
 
 fn generate_capture_path(path: *const c_char) -> Option<PathBuf> {
-    use std::fs::{File, create_dir_all};
+    use std::fs::{create_dir_all, File};
     use std::io::Write;
 
     let cstr = unsafe { CStr::from_ptr(path) };
     let mut path = PathBuf::from(&*cstr.to_string_lossy());
 
     #[cfg(target_os = "android")]
     {
         // On Android we need to write into a particular folder on external
@@ -2038,17 +2037,17 @@ fn generate_capture_path(path: *const c_
         Ok(mut file) => {
             // The Gecko HG revision is available at compile time
             if let Some(moz_revision) = option_env!("GECKO_HEAD_REV") {
                 writeln!(file, "mozilla-central {}", moz_revision).unwrap();
             }
         }
         Err(e) => {
             warn!("Unable to create path '{:?}' for capture: {:?}", path, e);
-            return None
+            return None;
         }
     }
 
     Some(path)
 }
 
 #[no_mangle]
 pub extern "C" fn wr_api_capture(dh: &mut DocumentHandle, path: *const c_char, bits_raw: u32) {
@@ -2477,20 +2476,17 @@ pub extern "C" fn wr_dp_define_image_mas
     parent: &WrSpaceAndClipChain,
     mask: ImageMask,
 ) -> WrClipId {
     debug_assert!(unsafe { is_in_main_thread() });
 
     let clip_id = state
         .frame_builder
         .dl_builder
-        .define_clip_image_mask(
-            &parent.to_webrender(state.pipeline_id),
-            mask,
-        );
+        .define_clip_image_mask(&parent.to_webrender(state.pipeline_id), mask);
     WrClipId::from_webrender(clip_id)
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_define_sticky_frame(
     state: &mut WrState,
     parent_spatial_id: WrSpatialId,
     content_rect: LayoutRect,
--- a/gfx/webrender_bindings/src/moz2d_renderer.rs
+++ b/gfx/webrender_bindings/src/moz2d_renderer.rs
@@ -651,23 +651,17 @@ fn rasterize_blob(job: Job) -> (BlobImag
             panic!("Moz2D replay problem");
         }
     };
 
     (job.request, result)
 }
 
 impl BlobImageHandler for Moz2dBlobImageHandler {
-    fn add(
-        &mut self,
-        key: BlobImageKey,
-        data: Arc<BlobImageData>,
-        visible_rect: &DeviceIntRect,
-        tile_size: TileSize,
-    ) {
+    fn add(&mut self, key: BlobImageKey, data: Arc<BlobImageData>, visible_rect: &DeviceIntRect, tile_size: TileSize) {
         {
             let index = BlobReader::new(&data);
             assert!(index.reader.has_more());
         }
         self.blob_commands.insert(
             key,
             BlobCommand {
                 data: Arc::clone(&data),
--- a/js/src/frontend/smoosh/src/lib.rs
+++ b/js/src/frontend/smoosh/src/lib.rs
@@ -79,17 +79,17 @@ pub struct SmooshGCThing {
     index: usize,
 }
 
 impl From<GCThing> for SmooshGCThing {
     fn from(item: GCThing) -> Self {
         match item {
             GCThing::Function(_index) => {
                 panic!("Not yet implemented");
-            },
+            }
             GCThing::Scope(index) => Self {
                 kind: SmooshGCThingKind::ScopeIndex,
                 index: index.into(),
             },
             GCThing::RegExp(index) => Self {
                 kind: SmooshGCThingKind::RegExpIndex,
                 index: index.into(),
             },
--- a/js/src/rust/lib.rs
+++ b/js/src/rust/lib.rs
@@ -9,12 +9,12 @@
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 extern crate jsrust_shared;
+extern crate wasmparser;
 extern crate wat;
-extern crate wasmparser;
 
 mod wasm;
--- a/js/src/wasm/cranelift/src/wasm2clif.rs
+++ b/js/src/wasm/cranelift/src/wasm2clif.rs
@@ -28,17 +28,17 @@ use cranelift_codegen::ir::immediates::O
 use cranelift_codegen::ir::InstBuilder;
 use cranelift_codegen::isa::{CallConv, TargetFrontendConfig, TargetIsa};
 use cranelift_codegen::packed_option::PackedOption;
 use cranelift_wasm::{
     FuncEnvironment, FuncIndex, GlobalIndex, GlobalVariable, MemoryIndex, ReturnMode,
     SignatureIndex, TableIndex, TargetEnvironment, WasmError, WasmResult,
 };
 
-use crate::bindings::{self, SymbolicAddress, GlobalDesc};
+use crate::bindings::{self, GlobalDesc, SymbolicAddress};
 use crate::compile::{symbolic_function_name, wasm_function_name};
 use crate::isa::POINTER_SIZE;
 
 #[cfg(target_pointer_width = "64")]
 pub const POINTER_TYPE: ir::Type = ir::types::I64;
 #[cfg(target_pointer_width = "32")]
 pub const POINTER_TYPE: ir::Type = ir::types::I32;
 
--- a/media/audioipc/client/src/context.rs
+++ b/media/audioipc/client/src/context.rs
@@ -9,23 +9,20 @@ use crate::{ClientStream, AUDIOIPC_INIT_
 #[cfg(target_os = "linux")]
 use audio_thread_priority::get_current_thread_info;
 #[cfg(not(target_os = "linux"))]
 use audio_thread_priority::promote_current_thread_to_real_time;
 use audioipc::codec::LengthDelimitedCodec;
 use audioipc::frame::{framed, Framed};
 use audioipc::platformhandle_passing::{framed_with_platformhandles, FramedWithPlatformHandles};
 use audioipc::{core, rpc};
-use audioipc::{
-    messages, messages::DeviceCollectionReq, messages::DeviceCollectionResp, ClientMessage,
-    ServerMessage,
-};
+use audioipc::{messages, messages::DeviceCollectionReq, messages::DeviceCollectionResp, ClientMessage, ServerMessage};
 use cubeb_backend::{
-    ffi, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceType, Error, Ops, Result,
-    Stream, StreamParams, StreamParamsRef,
+    ffi, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceType, Error, Ops, Result, Stream, StreamParams,
+    StreamParamsRef,
 };
 use futures::Future;
 use futures_cpupool::{CpuFuture, CpuPool};
 use std::ffi::{CStr, CString};
 use std::os::raw::c_void;
 use std::sync::mpsc;
 use std::sync::{Arc, Mutex};
 use std::thread;
@@ -33,20 +30,18 @@ use std::{fmt, io, mem, ptr};
 use tokio::reactor;
 use tokio::runtime::current_thread;
 
 struct CubebClient;
 
 impl rpc::Client for CubebClient {
     type Request = ServerMessage;
     type Response = ClientMessage;
-    type Transport = FramedWithPlatformHandles<
-        audioipc::AsyncMessageStream,
-        LengthDelimitedCodec<Self::Request, Self::Response>,
-    >;
+    type Transport =
+        FramedWithPlatformHandles<audioipc::AsyncMessageStream, LengthDelimitedCodec<Self::Request, Self::Response>>;
 }
 
 pub const CLIENT_OPS: Ops = capi_new!(ClientContext, ClientStream);
 
 // ClientContext's layout *must* match cubeb.c's `struct cubeb` for the
 // common fields.
 #[repr(C)]
 pub struct ClientContext {
@@ -136,49 +131,41 @@ struct DeviceCollectionServer {
     output_device_callback: Arc<Mutex<DeviceCollectionCallback>>,
     cpu_pool: CpuPool,
 }
 
 impl rpc::Server for DeviceCollectionServer {
     type Request = DeviceCollectionReq;
     type Response = DeviceCollectionResp;
     type Future = CpuFuture<Self::Response, ()>;
-    type Transport =
-        Framed<audioipc::AsyncMessageStream, LengthDelimitedCodec<Self::Response, Self::Request>>;
+    type Transport = Framed<audioipc::AsyncMessageStream, LengthDelimitedCodec<Self::Response, Self::Request>>;
 
     fn process(&mut self, req: Self::Request) -> Self::Future {
         match req {
             DeviceCollectionReq::DeviceChange(device_type) => {
-                trace!(
-                    "ctx_thread: DeviceChange Callback: device_type={}",
-                    device_type
-                );
+                trace!("ctx_thread: DeviceChange Callback: device_type={}", device_type);
 
                 let devtype = cubeb_backend::DeviceType::from_bits_truncate(device_type);
 
                 let (input_cb, input_user_ptr) = {
                     let dcb = self.input_device_callback.lock().unwrap();
                     (dcb.cb, dcb.user_ptr)
                 };
                 let (output_cb, output_user_ptr) = {
                     let dcb = self.output_device_callback.lock().unwrap();
                     (dcb.cb, dcb.user_ptr)
                 };
 
                 self.cpu_pool.spawn_fn(move || {
                     run_in_callback(|| {
                         if devtype.contains(cubeb_backend::DeviceType::INPUT) {
-                            unsafe {
-                                input_cb.unwrap()(ptr::null_mut(), input_user_ptr as *mut c_void)
-                            }
+                            unsafe { input_cb.unwrap()(ptr::null_mut(), input_user_ptr as *mut c_void) }
                         }
                         if devtype.contains(cubeb_backend::DeviceType::OUTPUT) {
-                            unsafe {
-                                output_cb.unwrap()(ptr::null_mut(), output_user_ptr as *mut c_void)
-                            }
+                            unsafe { output_cb.unwrap()(ptr::null_mut(), output_user_ptr as *mut c_void) }
                         }
                     });
 
                     Ok(DeviceCollectionResp::DeviceChange)
                 })
             }
         }
     }
@@ -201,18 +188,17 @@ impl ContextOps for ClientContext {
         assert_not_in_callback();
 
         let (tx_rpc, rx_rpc) = mpsc::channel();
 
         let params = AUDIOIPC_INIT_PARAMS.with(|p| p.replace(None).unwrap());
         let thread_create_callback = params.thread_create_callback;
         let thread_destroy_callback = params.thread_destroy_callback;
 
-        let server_stream =
-            unsafe { audioipc::MessageStream::from_raw_fd(params.server_connection) };
+        let server_stream = unsafe { audioipc::MessageStream::from_raw_fd(params.server_connection) };
 
         let core = core::spawn_thread(
             "AudioIPC Client RPC",
             move || {
                 let handle = reactor::Handle::default();
 
                 register_thread(thread_create_callback);
 
@@ -226,18 +212,18 @@ impl ContextOps for ClientContext {
 
         let rpc = rx_rpc.recv().map_err(|_| Error::default())?;
         let rpc2 = rpc.clone();
 
         // Don't let errors bubble from here.  Later calls against this context
         // will return errors the caller expects to handle.
         let _ = send_recv!(rpc, ClientConnect(std::process::id()) => ClientConnected);
 
-        let backend_id = send_recv!(rpc, ContextGetBackendId => ContextBackendId())
-            .unwrap_or_else(|_| "(remote error)".to_string());
+        let backend_id =
+            send_recv!(rpc, ContextGetBackendId => ContextBackendId()).unwrap_or_else(|_| "(remote error)".to_string());
         let backend_id = CString::new(backend_id).expect("backend_id query failed");
 
         let cpu_pool = futures_cpupool::Builder::new()
             .name_prefix("AudioIPC")
             .after_start(move || promote_and_register_thread(&rpc2, thread_create_callback))
             .before_stop(move || unregister_thread(thread_destroy_callback))
             .pool_size(params.pool_size)
             .stack_size(params.stack_size)
@@ -272,21 +258,17 @@ impl ContextOps for ClientContext {
         send_recv!(self.rpc(), ContextGetMinLatency(params) => ContextMinLatency())
     }
 
     fn preferred_sample_rate(&mut self) -> Result<u32> {
         assert_not_in_callback();
         send_recv!(self.rpc(), ContextGetPreferredSampleRate => ContextPreferredSampleRate())
     }
 
-    fn enumerate_devices(
-        &mut self,
-        devtype: DeviceType,
-        collection: &DeviceCollectionRef,
-    ) -> Result<()> {
+    fn enumerate_devices(&mut self, devtype: DeviceType, collection: &DeviceCollectionRef) -> Result<()> {
         assert_not_in_callback();
         let v: Vec<ffi::cubeb_device_info> = match send_recv!(self.rpc(),
                              ContextGetDeviceEnumeration(devtype.bits()) =>
                              ContextEnumeratedDevices())
         {
             Ok(mut v) => v.drain(..).map(|i| i.into()).collect(),
             Err(e) => return Err(e),
         };
@@ -299,21 +281,17 @@ impl ContextOps for ClientContext {
         mem::forget(vs);
         Ok(())
     }
 
     fn device_collection_destroy(&mut self, collection: &mut DeviceCollectionRef) -> Result<()> {
         assert_not_in_callback();
         unsafe {
             let coll = &mut *collection.as_ptr();
-            let mut devices = Vec::from_raw_parts(
-                coll.device as *mut ffi::cubeb_device_info,
-                coll.count,
-                coll.count,
-            );
+            let mut devices = Vec::from_raw_parts(coll.device as *mut ffi::cubeb_device_info, coll.count, coll.count);
             for dev in &mut devices {
                 if !dev.device_id.is_null() {
                     let _ = CString::from_raw(dev.device_id as *mut _);
                 }
                 if !dev.group_id.is_null() {
                     let _ = CString::from_raw(dev.group_id as *mut _);
                 }
                 if !dev.vendor_name.is_null() {
@@ -378,18 +356,17 @@ impl ContextOps for ClientContext {
     ) -> Result<()> {
         assert_not_in_callback();
 
         if !self.device_collection_rpc {
             let fds = send_recv!(self.rpc(),
                                  ContextSetupDeviceCollectionCallback =>
                                  ContextSetupDeviceCollectionCallback())?;
 
-            let stream =
-                unsafe { audioipc::MessageStream::from_raw_fd(fds.platform_handles[0].into_raw()) };
+            let stream = unsafe { audioipc::MessageStream::from_raw_fd(fds.platform_handles[0].into_raw()) };
 
             // TODO: The lowest comms layer expects exactly 3 PlatformHandles, but we only
             // need one here.  Drop the dummy handles the other side sent us to discard.
             unsafe {
                 fds.platform_handles[1].into_file();
                 fds.platform_handles[2].into_file();
             }
 
--- a/media/audioipc/client/src/stream.rs
+++ b/media/audioipc/client/src/stream.rs
@@ -57,18 +57,17 @@ struct CallbackServer {
     cpu_pool: CpuPool,
     device_change_cb: Arc<Mutex<ffi::cubeb_device_changed_callback>>,
 }
 
 impl rpc::Server for CallbackServer {
     type Request = CallbackReq;
     type Response = CallbackResp;
     type Future = CpuFuture<Self::Response, ()>;
-    type Transport =
-        Framed<audioipc::AsyncMessageStream, LengthDelimitedCodec<Self::Response, Self::Request>>;
+    type Transport = Framed<audioipc::AsyncMessageStream, LengthDelimitedCodec<Self::Response, Self::Request>>;
 
     fn process(&mut self, req: Self::Request) -> Self::Future {
         match req {
             CallbackReq::Data {
                 nframes,
                 input_frame_size,
                 output_frame_size,
             } => {
@@ -89,20 +88,17 @@ impl rpc::Server for CallbackServer {
                     None => None,
                 };
                 let user_ptr = self.user_ptr;
                 let cb = self.data_cb.unwrap();
 
                 self.cpu_pool.spawn_fn(move || {
                     // TODO: This is proof-of-concept. Make it better.
                     let input_ptr: *const u8 = match input_shm {
-                        Some(shm) => shm
-                            .get_slice(nframes as usize * input_frame_size)
-                            .unwrap()
-                            .as_ptr(),
+                        Some(shm) => shm.get_slice(nframes as usize * input_frame_size).unwrap().as_ptr(),
                         None => ptr::null(),
                     };
                     let output_ptr: *mut u8 = match output_shm {
                         Some(ref mut shm) => shm
                             .get_mut_slice(nframes as usize * output_frame_size)
                             .unwrap()
                             .as_mut_ptr(),
                         None => ptr::null_mut(),
@@ -168,23 +164,19 @@ impl<'ctx> ClientStream<'ctx> {
         assert_not_in_callback();
 
         let has_input = init_params.input_stream_params.is_some();
         let has_output = init_params.output_stream_params.is_some();
 
         let rpc = ctx.rpc();
         let data = send_recv!(rpc, StreamInit(init_params) => StreamCreated())?;
 
-        debug!(
-            "token = {}, handles = {:?}",
-            data.token, data.platform_handles
-        );
+        debug!("token = {}, handles = {:?}", data.token, data.platform_handles);
 
-        let stream =
-            unsafe { audioipc::MessageStream::from_raw_fd(data.platform_handles[0].into_raw()) };
+        let stream = unsafe { audioipc::MessageStream::from_raw_fd(data.platform_handles[0].into_raw()) };
 
         let input_file = unsafe { data.platform_handles[1].into_file() };
         let input_shm = if has_input {
             match SharedMemSlice::from(&input_file, audioipc::SHM_AREA_SIZE) {
                 Ok(shm) => Some(shm),
                 Err(e) => {
                     debug!("Client failed to set up input shmem: {}", e);
                     return Err(Error::error());
--- a/testing/mozbase/rust/mozdevice/src/lib.rs
+++ b/testing/mozbase/rust/mozdevice/src/lib.rs
@@ -405,30 +405,32 @@ impl Device {
 
     pub fn force_stop(&self, package: &str) -> Result<()> {
         debug!("Force stopping Android package: {}", package);
         self.execute_host_shell_command(&format!("am force-stop {}", package))
             .and(Ok(()))
     }
 
     pub fn forward_port(&self, local: u16, remote: u16) -> Result<u16> {
-        let command = format!("host-serial:{}:forward:tcp:{};tcp:{}", self.serial, local, remote);
+        let command = format!(
+            "host-serial:{}:forward:tcp:{};tcp:{}",
+            self.serial, local, remote
+        );
         let response = self.host.execute_command(&command, true, false)?;
 
         if local == 0 {
             Ok(response.parse::<u16>()?)
         } else {
             Ok(local)
         }
     }
 
     pub fn kill_forward_port(&self, local: u16) -> Result<()> {
         let command = format!("killforward:tcp:{}", local);
-        self.execute_host_command(&command, true, false)
-            .and(Ok(()))
+        self.execute_host_command(&command, true, false).and(Ok(()))
     }
 
     pub fn kill_forward_all_ports(&self) -> Result<()> {
         self.execute_host_command(&"killforward-all".to_owned(), false, false)
             .and(Ok(()))
     }
 
     pub fn reverse_port(&self, remote: u16, local: u16) -> Result<u16> {
--- a/testing/webdriver/src/server.rs
+++ b/testing/webdriver/src/server.rs
@@ -173,20 +173,24 @@ where
     U: 'static + WebDriverExtensionRoute + Send + Sync,
 {
     let listener = StdTcpListener::bind(address)?;
     let addr = listener.local_addr()?;
     let (msg_send, msg_recv) = channel();
 
     let builder = thread::Builder::new().name("webdriver server".to_string());
     let handle = builder.spawn(move || {
-        let mut rt = tokio::runtime::Builder::new().basic_scheduler().enable_io().build().unwrap();
-        let mut listener = rt.handle().enter(|| {
-            TcpListener::from_std(listener).unwrap()
-        });
+        let mut rt = tokio::runtime::Builder::new()
+            .basic_scheduler()
+            .enable_io()
+            .build()
+            .unwrap();
+        let mut listener = rt
+            .handle()
+            .enter(|| TcpListener::from_std(listener).unwrap());
         let wroutes = build_warp_routes(&extension_routes, msg_send.clone());
         let fut = warp::serve(wroutes).run_incoming(listener.incoming());
         rt.block_on(fut);
     })?;
 
     let builder = thread::Builder::new().name("webdriver dispatcher".to_string());
     builder.spawn(move || {
         let mut dispatcher = Dispatcher::new(handler);
@@ -335,9 +339,8 @@ fn build_route<U: 'static + WebDriverExt
             "application/json; charset=utf-8",
         ))
         .with(warp::reply::with::header(
             http::header::CACHE_CONTROL,
             "no-cache",
         ))
         .boxed()
 }
-
--- a/toolkit/components/bitsdownload/src/bits_interface/request.rs
+++ b/toolkit/components/bitsdownload/src/bits_interface/request.rs
@@ -237,21 +237,17 @@ impl BitsRequest {
                 warn!("Failed to cancel download: {:?}", rv);
             }
         }
     }
 
     pub fn on_progress(&self, transferred_bytes: i64, total_bytes: i64) {
         if let Some(progress_event_sink) = self.observer.query_interface::<nsIProgressEventSink>() {
             unsafe {
-                progress_event_sink.OnProgress(
-                    self.coerce(),
-                    transferred_bytes,
-                    total_bytes,
-                );
+                progress_event_sink.OnProgress(self.coerce(), transferred_bytes, total_bytes);
             }
         }
     }
 
     /// To be called when the transfer stops (fails or completes). Fires
     /// observer.OnStopRequest exactly once, though the call may be delayed to
     /// resolve a race condition.
     ///
--- a/toolkit/components/kvstore/src/task.rs
+++ b/toolkit/components/kvstore/src/task.rs
@@ -49,17 +49,18 @@ macro_rules! task_done {
             // it gets released on the main thread.
             let threadbound = self.callback.swap(None).ok_or(NS_ERROR_FAILURE)?;
             let callback = threadbound.get_ref().ok_or(NS_ERROR_FAILURE)?;
 
             match self.result.swap(None) {
                 Some(Ok(value)) => unsafe { callback.Resolve(self.convert(value)?.coerce()) },
                 Some(Err(err)) => unsafe { callback.Reject(&*nsCString::from(err.to_string())) },
                 None => unsafe { callback.Reject(&*nsCString::from("unexpected")) },
-            }.to_result()
+            }
+            .to_result()
         }
     };
 
     (void) => {
         fn done(&self) -> Result<(), nsresult> {
             // If TaskRunnable.run() calls Task.done() to return a result
             // on the main thread before TaskRunnable.run() returns on the database
             // thread, then the Task will get dropped on the database thread.
@@ -69,17 +70,18 @@ macro_rules! task_done {
             // it gets released on the main thread.
             let threadbound = self.callback.swap(None).ok_or(NS_ERROR_FAILURE)?;
             let callback = threadbound.get_ref().ok_or(NS_ERROR_FAILURE)?;
 
             match self.result.swap(None) {
                 Some(Ok(())) => unsafe { callback.Resolve() },
                 Some(Err(err)) => unsafe { callback.Reject(&*nsCString::from(err.to_string())) },
                 None => unsafe { callback.Reject(&*nsCString::from("unexpected")) },
-            }.to_result()
+            }
+            .to_result()
         }
     };
 }
 
 /// A tuple comprising an Arc<RwLock<Rkv>> and a SingleStore, which is
 /// the result of GetOrCreateTask.  We declare this type because otherwise
 /// Clippy complains "error: very complex type used. Consider factoring
 /// parts into `type` definitions" (i.e. clippy::type-complexity) when we
--- a/toolkit/components/places/bookmark_sync/src/store.rs
+++ b/toolkit/components/places/bookmark_sync/src/store.rs
@@ -239,17 +239,20 @@ impl<'s> Store<'s> {
         item.age = (self.remote_time_millis - remote_modified).max(0);
 
         let needs_merge: i32 = step.get_by_name("needsMerge")?;
         item.needs_merge = needs_merge == 1;
 
         let raw_validity: i64 = step.get_by_name("validity")?;
         item.validity = Validity::from_column(raw_validity)?;
 
-        let content = if item.validity == Validity::Replace || item.guid == dogear::ROOT_GUID || !item.needs_merge {
+        let content = if item.validity == Validity::Replace
+            || item.guid == dogear::ROOT_GUID
+            || !item.needs_merge
+        {
             None
         } else {
             match kind {
                 Kind::Bookmark | Kind::Query => {
                     let raw_title: nsString = step.get_by_name("title")?;
                     let title = String::from_utf16(&*raw_title)?;
                     let raw_url_href: Option<nsString> = step.get_by_name("url")?;
                     match raw_url_href {
--- a/toolkit/components/updateagent/src/taskschd.rs
+++ b/toolkit/components/updateagent/src/taskschd.rs
@@ -57,86 +57,76 @@ pub fn hr_is_already_exists(hr: &HResult
 
 /// put a bool, converting to `VARIANT_BOOL`
 macro_rules! bool_putter {
     ($interface:ident :: $method:ident) => {
         #[allow(non_snake_case)]
         pub fn $method(&mut self, v: bool) -> Result<(), HResult> {
             let v = v.into_variant_bool();
             unsafe {
-                com_call!(
-                    self.0,
-                    $interface :: $method(v))?;
+                com_call!(self.0, $interface::$method(v))?;
             }
             Ok(())
         }
-    }
+    };
 }
 
 /// put a value that is already available as a `BString`
 macro_rules! bstring_putter {
     ($interface:ident :: $method:ident) => {
         #[allow(non_snake_case)]
         pub fn $method(&mut self, v: &BString) -> Result<(), HResult> {
             unsafe {
-                com_call!(
-                    self.0,
-                    $interface :: $method(v.as_raw_ptr()))?;
+                com_call!(self.0, $interface::$method(v.as_raw_ptr()))?;
             }
             Ok(())
         }
-    }
+    };
 }
 
 /// put a `chrono::DateTime` value
 macro_rules! datetime_putter {
     ($interface:ident :: $method:ident) => {
         #[allow(non_snake_case)]
         pub fn $method(&mut self, v: chrono::DateTime<chrono::Utc>) -> Result<(), HResult> {
             let v = try_to_bstring!(v.to_rfc3339_opts(chrono::SecondsFormat::Secs, true))?;
             unsafe {
-                com_call!(
-                    self.0,
-                    $interface :: $method(v.as_raw_ptr()))?;
+                com_call!(self.0, $interface::$method(v.as_raw_ptr()))?;
             }
             Ok(())
         }
-    }
+    };
 }
 
 /// put a value of type `$ty`, which implements `AsRef<OsStr>`
 macro_rules! to_os_str_putter {
     ($interface:ident :: $method:ident, $ty:ty) => {
         #[allow(non_snake_case)]
         pub fn $method(&mut self, v: $ty) -> Result<(), HResult> {
             let v = try_to_bstring!(v)?;
             unsafe {
-                com_call!(
-                    self.0,
-                    $interface :: $method(v.as_raw_ptr()))?;
+                com_call!(self.0, $interface::$method(v.as_raw_ptr()))?;
             }
             Ok(())
         }
-    }
+    };
 }
 
 /// put a value of type `$ty`, which implements `ToString`
 macro_rules! to_string_putter {
     ($interface:ident :: $method:ident, $ty:ty) => {
         #[allow(non_snake_case)]
         pub fn $method(&mut self, v: $ty) -> Result<(), HResult> {
             let v = try_to_bstring!(v.to_string())?;
             unsafe {
-                com_call!(
-                    self.0,
-                    $interface :: $method(v.as_raw_ptr()))?;
+                com_call!(self.0, $interface::$method(v.as_raw_ptr()))?;
             }
             Ok(())
         }
-    }
+    };
 }
 
 pub struct TaskService(ComRef<ITaskService>);
 
 impl TaskService {
     pub fn connect_local() -> Result<TaskService, ConnectTaskServiceError> {
         use self::ConnectTaskServiceError::*;
 
--- a/xpcom/rust/nsstring/src/conversions.rs
+++ b/xpcom/rust/nsstring/src/conversions.rs
@@ -108,88 +108,94 @@ fn long_string_stars_with_basic_latin(bu
 /// `$name` is the name of the function to generate
 /// `$convert` is the underlying `encoding_rs::mem` function to use
 /// `$other_ty` is the type of the input slice
 /// `$math` is the worst-case length math that `$convert` expects
 macro_rules! shrinking_conversion {
     (name = $name:ident,
      convert = $convert:ident,
      other_ty = $other_ty:ty,
-     math = $math:ident) => (
+     math = $math:ident) => {
         fn $name(&mut self, other: $other_ty, old_len: usize) -> Result<BulkWriteOk, ()> {
             let needed = $math(other.len()).ok_or(())?;
-            let mut handle = unsafe {
-                self.bulk_write(old_len.checked_add(needed).ok_or(())?, old_len, false)?
-            };
+            let mut handle =
+                unsafe { self.bulk_write(old_len.checked_add(needed).ok_or(())?, old_len, false)? };
             let written = $convert(other, &mut handle.as_mut_slice()[old_len..]);
             let new_len = old_len + written;
             Ok(handle.finish(new_len, new_len > CACHE_LINE))
         }
-     )
+    };
 }
 
 /// A conversion where the number of code units in the output is always equal
 /// to the number of code units in the input.
 ///
 /// Takes the name of the method to be generated, the name of the conversion
 /// function and the type of the input slice.
 ///
 /// `$name` is the name of the function to generate
 /// `$convert` is the underlying `encoding_rs::mem` function to use
 /// `$other_ty` is the type of the input slice
 macro_rules! constant_conversion {
     (name = $name:ident,
      convert = $convert:ident,
-     other_ty = $other_ty:ty) => (
-        fn $name(&mut self, other: $other_ty, old_len: usize, allow_shrinking: bool) -> Result<BulkWriteOk, ()> {
+     other_ty = $other_ty:ty) => {
+        fn $name(
+            &mut self,
+            other: $other_ty,
+            old_len: usize,
+            allow_shrinking: bool,
+        ) -> Result<BulkWriteOk, ()> {
             let new_len = old_len.checked_add(other.len()).ok_or(())?;
-            let mut handle = unsafe {
-                self.bulk_write(new_len, old_len, allow_shrinking)?
-            };
+            let mut handle = unsafe { self.bulk_write(new_len, old_len, allow_shrinking)? };
             $convert(other, &mut handle.as_mut_slice()[old_len..]);
             Ok(handle.finish(new_len, false))
         }
-     )
+    };
 }
 
 /// An intermediate check for avoiding a copy and having an `nsStringBuffer`
 /// refcount increment instead when both `self` and `other` are `nsACString`s,
 /// `other` is entirely ASCII and all old data in `self` is discarded.
 ///
 /// `$name` is the name of the function to generate
 /// `$impl` is the underlying conversion that takes a slice and that is used
 ///         when we can't just adopt the incoming buffer as-is
 /// `$string_like` is the kind of input taken
 macro_rules! ascii_copy_avoidance {
     (name = $name:ident,
      implementation = $implementation:ident,
-     string_like = $string_like:ident) => (
-        fn $name<T: $string_like + ?Sized>(&mut self, other: &T, old_len: usize) -> Result<BulkWriteOk, ()> {
+     string_like = $string_like:ident) => {
+        fn $name<T: $string_like + ?Sized>(
+            &mut self,
+            other: &T,
+            old_len: usize,
+        ) -> Result<BulkWriteOk, ()> {
             let adapter = other.adapt();
             let other_slice = adapter.as_ref();
             let num_ascii = if adapter.is_abstract() && old_len == 0 {
                 let up_to = Encoding::ascii_valid_up_to(other_slice);
                 if up_to == other_slice.len() {
                     // Calling something whose argument can be obtained from
                     // the adapter rather than an nsStringLike avoids a huge
                     // lifetime mess by keeping nsStringLike and
                     // Latin1StringLike free of lifetime interdependencies.
                     if unsafe { Gecko_FallibleAssignCString(self, other.adapt().as_ptr()) } {
-                        return Ok(BulkWriteOk{});
+                        return Ok(BulkWriteOk {});
                     } else {
                         return Err(());
                     }
                 }
                 Some(up_to)
             } else {
                 None
             };
             self.$implementation(other_slice, old_len, num_ascii)
         }
-    )
+    };
 }
 
 impl nsAString {
     // Valid UTF-8 to UTF-16
 
     // Documentation says the destination buffer needs to have
     // as many code units as the input.
     shrinking_conversion!(