Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion etw/rust/tracelogging/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ categories = [
]
repository = "https://github.com/microsoft/tracelogging"
readme = "README.md"
rust-version = "1.63"
rust-version = "1.80"

[features]
default = ["etw", "macros"]
Expand Down
13 changes: 6 additions & 7 deletions etw/rust/tracelogging/src/guid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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) };
}
}

Expand All @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion etw/rust/tracelogging_dynamic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ categories = [
]
repository = "https://github.com/microsoft/tracelogging"
readme = "README.md"
rust-version = "1.63"
rust-version = "1.80"

[features]
default = ["etw"]
Expand Down
13 changes: 6 additions & 7 deletions etw/rust/tracelogging_dynamic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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<T: Copy>(&mut self, value: &[T]) -> &mut Self {
let value_size = value.len() * size_of::<T>();
let value_size = size_of_val(value);
let old_data_size = self.data.len();
self.data.reserve(value_size);
unsafe {
Expand Down
2 changes: 1 addition & 1 deletion etw/rust/tracelogging_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.80"

[lib]
proc-macro = true
Expand Down
9 changes: 4 additions & 5 deletions etw/rust/tracelogging_macros/src/guid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion etw/rust/tracelogging_macros/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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...)";
Expand Down
2 changes: 1 addition & 1 deletion etw/rust/tracelogging_macros/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Tree {
return self;
}

pub fn drain(&mut self) -> vec::Drain<TokenTree> {
pub fn drain(&mut self) -> vec::Drain<'_, TokenTree> {
debug_assert!(self.span_stack.is_empty());
return self.trees.drain(..);
}
Expand Down
Loading