Skip to content

Commit 9b6740e

Browse files
committed
cargo clippy --fix inside etw-reader
1 parent 57a415e commit 9b6740e

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

etw-reader/src/etw_types.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl Deref for EventRecord {
2222

2323
impl EventRecord {
2424
pub(crate) fn user_buffer(&self) -> &[u8] {
25-
if self.UserData == std::ptr::null_mut() {
25+
if self.UserData.is_null() {
2626
return &[];
2727
}
2828
unsafe { std::slice::from_raw_parts(self.UserData as *mut _, self.UserDataLength.into()) }
@@ -71,21 +71,21 @@ pub const EVENT_HEADER_FLAG_32_BIT_HEADER: u16 = Etw::EVENT_HEADER_FLAG_32_BIT_H
7171
/// [DECODING_SOURCE]: https://microsoft.github.io/windows-docs-rs/doc/bindings/Windows/Win32/Etw/struct.DECODING_SOURCE.html
7272
#[derive(Debug)]
7373
pub enum DecodingSource {
74-
DecodingSourceXMLFile,
75-
DecodingSourceWbem,
76-
DecodingSourceWPP,
77-
DecodingSourceTlg,
78-
DecodingSourceMax,
74+
XMLFile,
75+
Wbem,
76+
Wpp,
77+
Tlg,
78+
Max,
7979
}
8080

8181
impl From<Etw::DECODING_SOURCE> for DecodingSource {
8282
fn from(val: Etw::DECODING_SOURCE) -> Self {
8383
match val {
84-
Etw::DecodingSourceXMLFile => DecodingSource::DecodingSourceXMLFile,
85-
Etw::DecodingSourceWbem => DecodingSource::DecodingSourceWbem,
86-
Etw::DecodingSourceWPP => DecodingSource::DecodingSourceWPP,
87-
Etw::DecodingSourceTlg => DecodingSource::DecodingSourceTlg,
88-
_ => DecodingSource::DecodingSourceMax,
84+
Etw::DecodingSourceXMLFile => DecodingSource::XMLFile,
85+
Etw::DecodingSourceWbem => DecodingSource::Wbem,
86+
Etw::DecodingSourceWPP => DecodingSource::Wpp,
87+
Etw::DecodingSourceTlg => DecodingSource::Tlg,
88+
_ => DecodingSource::Max,
8989
}
9090
}
9191
}

etw-reader/src/parser.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,7 @@ impl<'a> Parser<'a> {
179179
// as the size of AppName
180180

181181
// Fallback to Tdh
182-
return Ok(
183-
tdh::property_size(self.event.record(), &property.name).unwrap() as usize,
184-
);
182+
Ok(tdh::property_size(self.event.record(), &property.name).unwrap() as usize)
185183
}
186184
PropertyLength::Length(length) => {
187185
// TODO: Study heuristic method used in krabsetw :)
@@ -222,9 +220,7 @@ impl<'a> Parser<'a> {
222220
}
223221
}
224222
}
225-
return Ok(
226-
tdh::property_size(self.event.record(), &property.name).unwrap() as usize,
227-
);
223+
Ok(tdh::property_size(self.event.record(), &property.name).unwrap() as usize)
228224
}
229225
}
230226
}

etw-reader/src/schema.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,12 +466,12 @@ impl<'a> TypedEvent<'a> {
466466
}
467467
}
468468

469-
impl<'a> PartialEq for TypedEvent<'a> {
469+
impl PartialEq for TypedEvent<'_> {
470470
fn eq(&self, other: &Self) -> bool {
471471
self.schema.event_schema.event_id() == other.schema.event_schema.event_id()
472472
&& self.schema.event_schema.provider_guid() == other.schema.event_schema.provider_guid()
473473
&& self.schema.event_schema.event_version() == other.schema.event_schema.event_version()
474474
}
475475
}
476476

477-
impl<'a> Eq for TypedEvent<'a> {}
477+
impl Eq for TypedEvent<'_> {}

0 commit comments

Comments
 (0)