From 5a333469a12d738c51e47552085660200d796a3e Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Tue, 12 Dec 2023 08:43:24 -0600 Subject: [PATCH] rust_2018_idioms --- crates/libs/bindgen/src/rdl/mod.rs | 20 +++++++++---------- crates/libs/bindgen/src/rust/writer.rs | 2 +- crates/libs/core/src/imp/sha1.rs | 2 +- crates/libs/implement/src/lib.rs | 6 +++--- crates/libs/interface/src/lib.rs | 6 +++--- .../windows/src/Windows/Devices/Sms/mod.rs | 12 +++++------ .../windows/src/Windows/Foundation/mod.rs | 8 ++++---- .../Security/Authentication/OnlineId/mod.rs | 4 ++-- .../src/Windows/Storage/Streams/mod.rs | 4 ++-- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/crates/libs/bindgen/src/rdl/mod.rs b/crates/libs/bindgen/src/rdl/mod.rs index 6cabb168bb..dec1554cac 100644 --- a/crates/libs/bindgen/src/rdl/mod.rs +++ b/crates/libs/bindgen/src/rdl/mod.rs @@ -136,7 +136,7 @@ pub struct Interface { syn::custom_keyword!(interface); syn::custom_keyword!(class); -fn winrt(input: syn::parse::ParseStream) -> syn::Result { +fn winrt(input: syn::parse::ParseStream<'_>) -> syn::Result { let attributes = input.call(syn::Attribute::parse_inner)?; if attributes.len() == 1 { if let syn::Meta::Path(path) = &attributes[0].meta { @@ -154,7 +154,7 @@ fn winrt(input: syn::parse::ParseStream) -> syn::Result { } impl syn::parse::Parse for File { - fn parse(input: syn::parse::ParseStream) -> syn::Result { + fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result { let mut references = vec![]; let mut modules = vec![]; let winrt = winrt(input)?; @@ -178,7 +178,7 @@ impl Module { self.namespace.rsplit_once('.').map_or(&self.namespace, |(_, name)| name) } - fn parse(namespace: &str, winrt: bool, input: syn::parse::ParseStream) -> syn::Result { + fn parse(namespace: &str, winrt: bool, input: syn::parse::ParseStream<'_>) -> syn::Result { input.parse::()?; let name = input.parse::()?.to_string(); @@ -195,7 +195,7 @@ impl Module { } impl ModuleMember { - fn parse(namespace: &str, winrt: bool, input: syn::parse::ParseStream) -> syn::Result { + fn parse(namespace: &str, winrt: bool, input: syn::parse::ParseStream<'_>) -> syn::Result { let attributes: Vec = input.call(syn::Attribute::parse_outer)?; let lookahead = input.lookahead1(); if lookahead.peek(syn::Token![mod]) { @@ -222,7 +222,7 @@ impl ModuleMember { } impl Class { - fn parse(attributes: Vec, input: syn::parse::ParseStream) -> syn::Result { + fn parse(attributes: Vec, input: syn::parse::ParseStream<'_>) -> syn::Result { input.parse::()?; let name = input.parse::()?.to_string(); let mut extends = Vec::new(); @@ -247,7 +247,7 @@ impl Class { } impl Interface { - fn parse(_namespace: &str, winrt: bool, attributes: Vec, input: syn::parse::ParseStream) -> syn::Result { + fn parse(_namespace: &str, winrt: bool, attributes: Vec, input: syn::parse::ParseStream<'_>) -> syn::Result { input.parse::()?; let name = input.parse::()?.to_string(); @@ -284,7 +284,7 @@ impl Interface { } impl Struct { - fn parse(_namespace: &str, winrt: bool, attributes: Vec, input: syn::parse::ParseStream) -> syn::Result { + fn parse(_namespace: &str, winrt: bool, attributes: Vec, input: syn::parse::ParseStream<'_>) -> syn::Result { // TODO: need to validate that the struct is valid according to the constraints of the winmd type system. // Same for the other types. That way we can spit out errors quickly for things like unnamed fields. let span = input.span(); @@ -311,7 +311,7 @@ impl Struct { } impl Enum { - fn parse(_namespace: &str, winrt: bool, attributes: Vec, input: syn::parse::ParseStream) -> syn::Result { + fn parse(_namespace: &str, winrt: bool, attributes: Vec, input: syn::parse::ParseStream<'_>) -> syn::Result { let mut item: syn::ItemEnum = input.parse()?; item.attrs = attributes; let name = item.ident.to_string(); @@ -320,7 +320,7 @@ impl Enum { } impl Constant { - fn parse(_namespace: &str, attributes: Vec, input: syn::parse::ParseStream) -> syn::Result { + fn parse(_namespace: &str, attributes: Vec, input: syn::parse::ParseStream<'_>) -> syn::Result { let mut item: syn::ItemConst = input.parse()?; item.attrs = attributes; let name = item.ident.to_string(); @@ -329,7 +329,7 @@ impl Constant { } impl Function { - fn parse(_namespace: &str, attributes: Vec, input: syn::parse::ParseStream) -> syn::Result { + fn parse(_namespace: &str, attributes: Vec, input: syn::parse::ParseStream<'_>) -> syn::Result { let mut item: syn::TraitItemFn = input.parse()?; item.attrs = attributes; let name = item.sig.ident.to_string(); diff --git a/crates/libs/bindgen/src/rust/writer.rs b/crates/libs/bindgen/src/rust/writer.rs index bc7ce5f051..9132953e9d 100644 --- a/crates/libs/bindgen/src/rust/writer.rs +++ b/crates/libs/bindgen/src/rust/writer.rs @@ -618,7 +618,7 @@ impl Writer { impl<#constraints> ::std::future::Future for #ident { type Output = ::windows_core::Result<#return_type>; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == #namespace AsyncStatus::Started { let waker = context.waker().clone(); diff --git a/crates/libs/core/src/imp/sha1.rs b/crates/libs/core/src/imp/sha1.rs index 55afc8ce23..14ef98fb7e 100644 --- a/crates/libs/core/src/imp/sha1.rs +++ b/crates/libs/core/src/imp/sha1.rs @@ -364,7 +364,7 @@ impl Digest { } impl std::fmt::Display for Digest { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { for i in self.data.iter() { write!(f, "{:08x}", i)?; } diff --git a/crates/libs/implement/src/lib.rs b/crates/libs/implement/src/lib.rs index 297e202ad9..cd3a7ca849 100644 --- a/crates/libs/implement/src/lib.rs +++ b/crates/libs/implement/src/lib.rs @@ -238,7 +238,7 @@ struct ImplementAttributes { } impl syn::parse::Parse for ImplementAttributes { - fn parse(cursor: syn::parse::ParseStream) -> syn::parse::Result { + fn parse(cursor: syn::parse::ParseStream<'_>) -> syn::parse::Result { let mut input = Self::default(); while !cursor.is_empty() { @@ -250,7 +250,7 @@ impl syn::parse::Parse for ImplementAttributes { } impl ImplementAttributes { - fn parse_implement(&mut self, cursor: syn::parse::ParseStream) -> syn::parse::Result<()> { + fn parse_implement(&mut self, cursor: syn::parse::ParseStream<'_>) -> syn::parse::Result<()> { let tree = cursor.parse::()?; self.walk_implement(&tree, &mut String::new())?; @@ -341,7 +341,7 @@ struct UseGroup2 { } impl syn::parse::Parse for UseTree2 { - fn parse(input: syn::parse::ParseStream) -> syn::parse::Result { + fn parse(input: syn::parse::ParseStream<'_>) -> syn::parse::Result { let lookahead = input.lookahead1(); if lookahead.peek(syn::Ident) { use syn::ext::IdentExt; diff --git a/crates/libs/interface/src/lib.rs b/crates/libs/interface/src/lib.rs index ea7aaecd88..eb62c7847a 100644 --- a/crates/libs/interface/src/lib.rs +++ b/crates/libs/interface/src/lib.rs @@ -374,7 +374,7 @@ impl Interface { } impl Parse for Interface { - fn parse(input: ParseStream) -> syn::Result { + fn parse(input: ParseStream<'_>) -> syn::Result { let attributes = input.call(syn::Attribute::parse_outer)?; let mut docs = Vec::new(); for attr in attributes.into_iter() { @@ -475,7 +475,7 @@ impl Guid { } impl Parse for Guid { - fn parse(cursor: ParseStream) -> syn::Result { + fn parse(cursor: ParseStream<'_>) -> syn::Result { let string: Option = cursor.parse().ok(); Ok(Self(string)) @@ -514,7 +514,7 @@ impl InterfaceMethod { } impl syn::parse::Parse for InterfaceMethod { - fn parse(input: syn::parse::ParseStream) -> syn::Result { + fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result { let docs = input.call(syn::Attribute::parse_outer)?; let visibility = input.parse::()?; let method = input.parse::()?; diff --git a/crates/libs/windows/src/Windows/Devices/Sms/mod.rs b/crates/libs/windows/src/Windows/Devices/Sms/mod.rs index fce7ff86af..13ce1d01cf 100644 --- a/crates/libs/windows/src/Windows/Devices/Sms/mod.rs +++ b/crates/libs/windows/src/Windows/Devices/Sms/mod.rs @@ -1254,7 +1254,7 @@ impl DeleteSmsMessageOperation { #[cfg(feature = "deprecated")] impl ::std::future::Future for DeleteSmsMessageOperation { type Output = ::windows_core::Result<()>; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == super::super::Foundation::AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&super::super::Foundation::AsyncActionCompletedHandler::new(move |_sender, _args| { @@ -1362,7 +1362,7 @@ impl DeleteSmsMessagesOperation { #[cfg(feature = "deprecated")] impl ::std::future::Future for DeleteSmsMessagesOperation { type Output = ::windows_core::Result<()>; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == super::super::Foundation::AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&super::super::Foundation::AsyncActionCompletedHandler::new(move |_sender, _args| { @@ -1473,7 +1473,7 @@ impl GetSmsDeviceOperation { #[cfg(feature = "deprecated")] impl ::std::future::Future for GetSmsDeviceOperation { type Output = ::windows_core::Result; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == super::super::Foundation::AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&super::super::Foundation::AsyncOperationCompletedHandler::new(move |_sender, _args| { @@ -1584,7 +1584,7 @@ impl GetSmsMessageOperation { #[cfg(feature = "deprecated")] impl ::std::future::Future for GetSmsMessageOperation { type Output = ::windows_core::Result; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == super::super::Foundation::AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&super::super::Foundation::AsyncOperationCompletedHandler::new(move |_sender, _args| { @@ -1719,7 +1719,7 @@ impl GetSmsMessagesOperation { #[cfg(all(feature = "Foundation_Collections", feature = "deprecated"))] impl ::std::future::Future for GetSmsMessagesOperation { type Output = ::windows_core::Result>; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == super::super::Foundation::AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&super::super::Foundation::AsyncOperationWithProgressCompletedHandler::new(move |_sender, _args| { @@ -1827,7 +1827,7 @@ impl SendSmsMessageOperation { #[cfg(feature = "deprecated")] impl ::std::future::Future for SendSmsMessageOperation { type Output = ::windows_core::Result<()>; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == super::super::Foundation::AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&super::super::Foundation::AsyncActionCompletedHandler::new(move |_sender, _args| { diff --git a/crates/libs/windows/src/Windows/Foundation/mod.rs b/crates/libs/windows/src/Windows/Foundation/mod.rs index e8dcbfef61..9a7e872e9f 100644 --- a/crates/libs/windows/src/Windows/Foundation/mod.rs +++ b/crates/libs/windows/src/Windows/Foundation/mod.rs @@ -83,7 +83,7 @@ impl IAsyncAction { } impl ::std::future::Future for IAsyncAction { type Output = ::windows_core::Result<()>; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&AsyncActionCompletedHandler::new(move |_sender, _args| { @@ -202,7 +202,7 @@ impl IAsyncActionWithProgress< } impl ::std::future::Future for IAsyncActionWithProgress { type Output = ::windows_core::Result<()>; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&AsyncActionWithProgressCompletedHandler::new(move |_sender, _args| { @@ -370,7 +370,7 @@ impl IAsyncOperation { } impl ::std::future::Future for IAsyncOperation { type Output = ::windows_core::Result; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&AsyncOperationCompletedHandler::new(move |_sender, _args| { @@ -497,7 +497,7 @@ impl ::std::future::Future for IAsyncOperationWithProgress { type Output = ::windows_core::Result; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&AsyncOperationWithProgressCompletedHandler::new(move |_sender, _args| { diff --git a/crates/libs/windows/src/Windows/Security/Authentication/OnlineId/mod.rs b/crates/libs/windows/src/Windows/Security/Authentication/OnlineId/mod.rs index 887b0657e9..0925853b6e 100644 --- a/crates/libs/windows/src/Windows/Security/Authentication/OnlineId/mod.rs +++ b/crates/libs/windows/src/Windows/Security/Authentication/OnlineId/mod.rs @@ -584,7 +584,7 @@ impl SignOutUserOperation { } impl ::std::future::Future for SignOutUserOperation { type Output = ::windows_core::Result<()>; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == super::super::super::Foundation::AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&super::super::super::Foundation::AsyncActionCompletedHandler::new(move |_sender, _args| { @@ -685,7 +685,7 @@ impl UserAuthenticationOperation { } impl ::std::future::Future for UserAuthenticationOperation { type Output = ::windows_core::Result; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == super::super::super::Foundation::AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&super::super::super::Foundation::AsyncOperationCompletedHandler::new(move |_sender, _args| { diff --git a/crates/libs/windows/src/Windows/Storage/Streams/mod.rs b/crates/libs/windows/src/Windows/Storage/Streams/mod.rs index f36ca6e85b..af358bb2d9 100644 --- a/crates/libs/windows/src/Windows/Storage/Streams/mod.rs +++ b/crates/libs/windows/src/Windows/Storage/Streams/mod.rs @@ -1429,7 +1429,7 @@ impl DataReaderLoadOperation { } impl ::std::future::Future for DataReaderLoadOperation { type Output = ::windows_core::Result; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == super::super::Foundation::AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&super::super::Foundation::AsyncOperationCompletedHandler::new(move |_sender, _args| { @@ -1718,7 +1718,7 @@ impl DataWriterStoreOperation { } impl ::std::future::Future for DataWriterStoreOperation { type Output = ::windows_core::Result; - fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context) -> ::std::task::Poll { + fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll { if self.Status()? == super::super::Foundation::AsyncStatus::Started { let waker = context.waker().clone(); let _ = self.SetCompleted(&super::super::Foundation::AsyncOperationCompletedHandler::new(move |_sender, _args| {