From 8d6da66bd897ca56f227853c9437f7bfa223279a Mon Sep 17 00:00:00 2001 From: Kyle Sabo Date: Sat, 5 Sep 2026 13:07:54 -0700 Subject: [PATCH 1/3] Fix clippy 1.98 lints --- etw/rust/tracelogging/src/guid.rs | 13 ++++++------- etw/rust/tracelogging_dynamic/src/builder.rs | 13 ++++++------- etw/rust/tracelogging_macros/src/guid.rs | 9 ++++----- etw/rust/tracelogging_macros/src/parser.rs | 2 +- etw/rust/tracelogging_macros/src/tree.rs | 2 +- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/etw/rust/tracelogging/src/guid.rs b/etw/rust/tracelogging/src/guid.rs index 9db7a5c..2791c45 100644 --- a/etw/rust/tracelogging/src/guid.rs +++ b/etw/rust/tracelogging/src/guid.rs @@ -246,7 +246,7 @@ impl Guid { /// Returns this implementation's in-memory byte representation. pub const fn as_bytes_raw(&self) -> &[u8; 16] { - return unsafe { mem::transmute(self) }; + return unsafe { mem::transmute::<&Guid, &[u8; 16]>(self) }; } /// Returns the bytes of the GUID in big-endian (RFC) byte order. @@ -384,7 +384,7 @@ impl fmt::Debug for Guid { impl borrow::Borrow<[u8; 16]> for Guid { /// Returns this implementation's in-memory byte representation. fn borrow(&self) -> &[u8; 16] { - return unsafe { mem::transmute(self) }; + return unsafe { mem::transmute::<&Guid, &[u8; 16]>(self) }; } } @@ -411,14 +411,13 @@ impl GuidParseState<'_> { } fn hex_to_u4(ch: u8) -> u32 { - let hexval; let mut index = ch.wrapping_sub(48); - if index < 10 { - hexval = index as u32; + let hexval = if index < 10 { + index as u32 } else { index = (ch | 32).wrapping_sub(97); - hexval = if index < 6 { (index + 10) as u32 } else { 256 }; - } + if index < 6 { (index + 10) as u32 } else { 256 } + }; return hexval; } } diff --git a/etw/rust/tracelogging_dynamic/src/builder.rs b/etw/rust/tracelogging_dynamic/src/builder.rs index a0ed89d..459cc86 100644 --- a/etw/rust/tracelogging_dynamic/src/builder.rs +++ b/etw/rust/tracelogging_dynamic/src/builder.rs @@ -181,10 +181,9 @@ impl EventBuilder { activity_id: Option<&Guid>, related_id: Option<&Guid>, ) -> u32 { - let result; let meta_len = self.meta.len(); - if meta_len > 65535 { - result = 534; // ERROR_ARITHMETIC_OVERFLOW + let result = if meta_len > 65535 { + 534 // ERROR_ARITHMETIC_OVERFLOW } else { self.meta[0] = meta_len as u8; self.meta[1] = (meta_len >> 8) as u8; @@ -194,13 +193,13 @@ impl EventBuilder { EventDataDescriptor::from_raw_bytes(&self.data, 0), // EVENT_DATA_DESCRIPTOR_TYPE_NONE ]; let ctx = &provider.context; - result = ctx.write_transfer( + ctx.write_transfer( &self.descriptor, activity_id.map(|g| g.as_bytes_raw()), related_id.map(|g| g.as_bytes_raw()), &dd, - ); - } + ) + }; return result; } @@ -1344,7 +1343,7 @@ impl EventBuilder { /// the TraceLogging encoding system. If done incorrectly, the resulting events will not /// decode properly. pub fn raw_add_data_slice(&mut self, value: &[T]) -> &mut Self { - let value_size = value.len() * size_of::(); + let value_size = size_of_val(value); let old_data_size = self.data.len(); self.data.reserve(value_size); unsafe { diff --git a/etw/rust/tracelogging_macros/src/guid.rs b/etw/rust/tracelogging_macros/src/guid.rs index d38f25d..199554e 100644 --- a/etw/rust/tracelogging_macros/src/guid.rs +++ b/etw/rust/tracelogging_macros/src/guid.rs @@ -397,14 +397,13 @@ impl GuidParseState<'_> { } fn hex_to_u4(ch: u8) -> u32 { - let hexval; let mut index = ch.wrapping_sub(48); - if index < 10 { - hexval = index as u32; + let hexval = if index < 10 { + index as u32 } else { index = (ch | 32).wrapping_sub(97); - hexval = if index < 6 { (index + 10) as u32 } else { 256 }; - } + if index < 6 { (index + 10) as u32 } else { 256 } + }; return hexval; } } diff --git a/etw/rust/tracelogging_macros/src/parser.rs b/etw/rust/tracelogging_macros/src/parser.rs index bb0a54c..f476184 100644 --- a/etw/rust/tracelogging_macros/src/parser.rs +++ b/etw/rust/tracelogging_macros/src/parser.rs @@ -181,7 +181,7 @@ impl<'a> Parser<'a> { /// Reads OptionIdent(ArgsGroup) or {...} then moves to the next comma or the end-of-stream. /// Emits "expected option" errors for non-option syntax. /// Emits "expected ..." error for other tokens encountered before comma or end-of-stream. - pub fn next_arg(&mut self, want_struct: bool) -> ArgResult { + pub fn next_arg(&mut self, want_struct: bool) -> ArgResult<'_> { const EXPECTED_OPTION: &str = "expected identifier for option name, e.g. Option(args...)"; const EXPECTED_OPTION_OR_STRUCT: &str = "expected '{' for struct or identifier for option name, e.g. Option(args...)"; diff --git a/etw/rust/tracelogging_macros/src/tree.rs b/etw/rust/tracelogging_macros/src/tree.rs index 9bac5b7..2fd3e20 100644 --- a/etw/rust/tracelogging_macros/src/tree.rs +++ b/etw/rust/tracelogging_macros/src/tree.rs @@ -32,7 +32,7 @@ impl Tree { return self; } - pub fn drain(&mut self) -> vec::Drain { + pub fn drain(&mut self) -> vec::Drain<'_, TokenTree> { debug_assert!(self.span_stack.is_empty()); return self.trees.drain(..); } From 25e3f9e21d0be45881d37bd4118b59d00c8e352e Mon Sep 17 00:00:00 2001 From: Kyle Sabo Date: Sat, 5 Sep 2026 13:11:46 -0700 Subject: [PATCH 2/3] Bump MSV to 1.70 --- etw/rust/tracelogging/Cargo.toml | 2 +- etw/rust/tracelogging_dynamic/Cargo.toml | 2 +- etw/rust/tracelogging_macros/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etw/rust/tracelogging/Cargo.toml b/etw/rust/tracelogging/Cargo.toml index df0e1a2..4a4aeec 100644 --- a/etw/rust/tracelogging/Cargo.toml +++ b/etw/rust/tracelogging/Cargo.toml @@ -21,7 +21,7 @@ categories = [ ] repository = "https://github.com/microsoft/tracelogging" readme = "README.md" -rust-version = "1.63" +rust-version = "1.70" [features] default = ["etw", "macros"] diff --git a/etw/rust/tracelogging_dynamic/Cargo.toml b/etw/rust/tracelogging_dynamic/Cargo.toml index c5ba7de..fa6da0a 100644 --- a/etw/rust/tracelogging_dynamic/Cargo.toml +++ b/etw/rust/tracelogging_dynamic/Cargo.toml @@ -21,7 +21,7 @@ categories = [ ] repository = "https://github.com/microsoft/tracelogging" readme = "README.md" -rust-version = "1.63" +rust-version = "1.70" [features] default = ["etw"] diff --git a/etw/rust/tracelogging_macros/Cargo.toml b/etw/rust/tracelogging_macros/Cargo.toml index b705a3a..f86d612 100644 --- a/etw/rust/tracelogging_macros/Cargo.toml +++ b/etw/rust/tracelogging_macros/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT" description = "TraceLogging for Rust Proc Macros" repository = "https://github.com/microsoft/tracelogging" readme = "README.md" -rust-version = "1.63" +rust-version = "1.70" [lib] proc-macro = true From 3fb4964991cd656632a428804a6bffbf07e1e4f3 Mon Sep 17 00:00:00 2001 From: Kyle Sabo Date: Sat, 5 Sep 2026 13:14:27 -0700 Subject: [PATCH 3/3] Bump MSV to 1.80 --- etw/rust/tracelogging/Cargo.toml | 2 +- etw/rust/tracelogging_dynamic/Cargo.toml | 2 +- etw/rust/tracelogging_macros/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etw/rust/tracelogging/Cargo.toml b/etw/rust/tracelogging/Cargo.toml index 4a4aeec..d76041e 100644 --- a/etw/rust/tracelogging/Cargo.toml +++ b/etw/rust/tracelogging/Cargo.toml @@ -21,7 +21,7 @@ categories = [ ] repository = "https://github.com/microsoft/tracelogging" readme = "README.md" -rust-version = "1.70" +rust-version = "1.80" [features] default = ["etw", "macros"] diff --git a/etw/rust/tracelogging_dynamic/Cargo.toml b/etw/rust/tracelogging_dynamic/Cargo.toml index fa6da0a..51b6673 100644 --- a/etw/rust/tracelogging_dynamic/Cargo.toml +++ b/etw/rust/tracelogging_dynamic/Cargo.toml @@ -21,7 +21,7 @@ categories = [ ] repository = "https://github.com/microsoft/tracelogging" readme = "README.md" -rust-version = "1.70" +rust-version = "1.80" [features] default = ["etw"] diff --git a/etw/rust/tracelogging_macros/Cargo.toml b/etw/rust/tracelogging_macros/Cargo.toml index f86d612..c608e21 100644 --- a/etw/rust/tracelogging_macros/Cargo.toml +++ b/etw/rust/tracelogging_macros/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT" description = "TraceLogging for Rust Proc Macros" repository = "https://github.com/microsoft/tracelogging" readme = "README.md" -rust-version = "1.70" +rust-version = "1.80" [lib] proc-macro = true