Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gentoo90 committed Jan 6, 2025
1 parent fb270ef commit c0a9406
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
5 changes: 1 addition & 4 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ macro_rules! werr {
}

pub(crate) fn to_utf16<P: AsRef<OsStr>>(s: P) -> Vec<u16> {
s.as_ref()
.encode_wide()
.chain(Some(0).into_iter())
.collect()
s.as_ref().encode_wide().chain(Some(0)).collect()
}

pub(crate) fn v16_to_v8(v: &[u16]) -> Vec<u8> {
Expand Down
2 changes: 1 addition & 1 deletion src/decoder/serialization_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl Error for DecoderError {
}
}

impl<'de, 'a> Deserializer<'de> for &'a mut Decoder {
impl<'de> Deserializer<'de> for &mut Decoder {
type Error = DecoderError;
fn deserialize_any<V>(self, visitor: V) -> DecodeResult<V::Value>
where
Expand Down
2 changes: 1 addition & 1 deletion src/encoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl Encoder<&Transaction> {
key: &RegKey,
tr: &'a Transaction,
) -> EncodeResult<Encoder<&'a Transaction>> {
key.open_subkey_transacted_with_flags("", &tr, ENCODER_SAM)
key.open_subkey_transacted_with_flags("", tr, ENCODER_SAM)
.map(|k| Encoder::new_transacted(k, tr))
.map_err(EncoderError::IoError)
}
Expand Down
8 changes: 4 additions & 4 deletions src/encoder/serialization_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,9 @@ impl serde::Serializer for MapKeySerializer {
Err(EncoderError::KeyMustBeAString)
}

fn collect_str<T: ?Sized>(self, value: &T) -> EncodeResult<String>
fn collect_str<T>(self, value: &T) -> EncodeResult<String>
where
T: fmt::Display,
T: fmt::Display + ?Sized,
{
Ok(value.to_string())
}
Expand All @@ -471,7 +471,7 @@ pub struct StructMapEncoder<'a, Tr: AsRef<Transaction>> {
is_root: bool,
}

impl<'a, Tr: AsRef<Transaction>> SerializeStruct for StructMapEncoder<'a, Tr> {
impl<Tr: AsRef<Transaction>> SerializeStruct for StructMapEncoder<'_, Tr> {
type Ok = ();
type Error = EncoderError;

Expand All @@ -492,7 +492,7 @@ impl<'a, Tr: AsRef<Transaction>> SerializeStruct for StructMapEncoder<'a, Tr> {
}
}

impl<'a, Tr: AsRef<Transaction>> SerializeMap for StructMapEncoder<'a, Tr> {
impl<Tr: AsRef<Transaction>> SerializeMap for StructMapEncoder<'_, Tr> {
type Ok = ();
type Error = EncoderError;

Expand Down
6 changes: 3 additions & 3 deletions src/reg_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ impl RegKey {
match unsafe {
winapi_reg::RegQueryValueExW(
self.hkey,
c_name.as_ptr() as *const u16,
c_name.as_ptr(),
ptr::null_mut(),
&mut buf_type,
buf.as_mut_ptr() as LPBYTE,
Expand Down Expand Up @@ -1020,7 +1020,7 @@ pub struct EnumKeys<'key> {
index: DWORD,
}

impl<'key> Iterator for EnumKeys<'key> {
impl Iterator for EnumKeys<'_> {
type Item = io::Result<String>;

fn next(&mut self) -> Option<io::Result<String>> {
Expand All @@ -1045,7 +1045,7 @@ pub struct EnumValues<'key> {
index: DWORD,
}

impl<'key> Iterator for EnumValues<'key> {
impl Iterator for EnumValues<'_> {
type Item = io::Result<(String, RegValue)>;

fn next(&mut self) -> Option<io::Result<(String, RegValue)>> {
Expand Down
1 change: 0 additions & 1 deletion src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
//! }
//!}
//!```
#![cfg(feature = "transactions")]
use std::io;
use std::ptr;
use winapi::um::handleapi;
Expand Down

0 comments on commit c0a9406

Please sign in to comment.