From 9de1e5fe717f24b3b4c3e32e51987160cf90bce8 Mon Sep 17 00:00:00 2001 From: Sean Burke Date: Thu, 30 May 2024 19:11:08 +0000 Subject: [PATCH] Bug 1899857 - Format Rust files and bring in line with MSRV. r=aleca DONTBUILD Differential Revision: https://phabricator.services.mozilla.com/D212152 --HG-- extra : moz-landing-system : lando --- rust/ews_xpcom/src/outgoing.rs | 12 +++++++----- rust/moz_http/src/client.rs | 6 +++++- rust/xpcom_async/src/sleep.rs | 10 ++++++++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/rust/ews_xpcom/src/outgoing.rs b/rust/ews_xpcom/src/outgoing.rs index 71fb0d2027..3a9be6e56a 100644 --- a/rust/ews_xpcom/src/outgoing.rs +++ b/rust/ews_xpcom/src/outgoing.rs @@ -189,8 +189,9 @@ impl EwsOutgoingServer { let host = ews_url.host_str().ok_or(nserror::NS_ERROR_FAILURE)?; let url = nsCString::from(format!("ews://{username}@{host}")); - let io_service = xpcom::get_service::(c"@mozilla.org/network/io-service;1") - .ok_or(nserror::NS_ERROR_FAILURE)?; + let io_service = + xpcom::get_service::(cstr::cstr!("@mozilla.org/network/io-service;1")) + .ok_or(nserror::NS_ERROR_FAILURE)?; getter_addrefs(|p| unsafe { io_service.NewURI(&*url, ptr::null(), ptr::null(), p) }) } @@ -312,9 +313,10 @@ impl EwsOutgoingServer { /// Open the file provided and read its content into a vector of bytes. fn read_file(file: &nsIFile) -> Result, nsresult> { - let file_stream = - create_instance::(c"@mozilla.org/network/file-input-stream;1") - .ok_or(nserror::NS_ERROR_FAILURE)?; + let file_stream = create_instance::(cstr::cstr!( + "@mozilla.org/network/file-input-stream;1" + )) + .ok_or(nserror::NS_ERROR_FAILURE)?; // Open a stream from the file, and figure out how many bytes can be read // from it. diff --git a/rust/moz_http/src/client.rs b/rust/moz_http/src/client.rs index 7012e32d1b..102628de16 100644 --- a/rust/moz_http/src/client.rs +++ b/rust/moz_http/src/client.rs @@ -52,7 +52,11 @@ impl Client { } /// Starts building an HTTP request to the given method and URL. - pub fn request<'rb>(&self, method: Method, url: &'rb Url) -> crate::Result> { + pub fn request<'rb>( + &self, + method: Method, + url: &'rb Url, + ) -> crate::Result> { RequestBuilder::new(method, url) } diff --git a/rust/xpcom_async/src/sleep.rs b/rust/xpcom_async/src/sleep.rs index a0db2570f4..41ffed2245 100644 --- a/rust/xpcom_async/src/sleep.rs +++ b/rust/xpcom_async/src/sleep.rs @@ -3,7 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::{ - cell::Cell, future::Future, task::{Poll, Waker} + cell::Cell, + future::Future, + task::{Poll, Waker}, }; use cstr::cstr; @@ -53,7 +55,11 @@ impl SleepTimer { }); unsafe { - timer.InitWithCallback(sleeper.coerce(), duration_in_ms, nsITimer::TYPE_ONE_SHOT as u32) + timer.InitWithCallback( + sleeper.coerce(), + duration_in_ms, + nsITimer::TYPE_ONE_SHOT as u32, + ) } .to_result()?;