Skip to content

Commit

Permalink
clippy: bump clippy to 1.81
Browse files Browse the repository at this point in the history
  • Loading branch information
baloo committed Jan 23, 2025
1 parent 9bf1737 commit 8d07216
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.71.0 # pinned to prevent CI breakages
toolchain: 1.81.0 # pinned to prevent CI breakages
components: clippy
- uses: actions-rs/cargo@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions src/audit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl<'de> Deserialize<'de> for AuditOption {
fn deserialize<D: de::Deserializer<'de>>(deserializer: D) -> Result<AuditOption, D::Error> {
struct AuditOptionVisitor;

impl<'de> de::Visitor<'de> for AuditOptionVisitor {
impl de::Visitor<'_> for AuditOptionVisitor {
type Value = AuditOption;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down Expand Up @@ -130,7 +130,7 @@ impl<'de> Deserialize<'de> for AuditTag {
fn deserialize<D: de::Deserializer<'de>>(deserializer: D) -> Result<AuditTag, D::Error> {
struct AuditTagVisitor;

impl<'de> de::Visitor<'de> for AuditTagVisitor {
impl de::Visitor<'_> for AuditTagVisitor {
type Value = AuditTag;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion src/capability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ impl<'de> Deserialize<'de> for Capability {
{
struct CapabilityVisitor;

impl<'de> Visitor<'de> for CapabilityVisitor {
impl Visitor<'_> for CapabilityVisitor {
type Value = Capability;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub(crate) trait Command: Serialize + DeserializeOwned + Sized {
const COMMAND_CODE: Code = Self::ResponseType::COMMAND_CODE;
}

impl<'c, C: Command> From<&'c C> for Message {
impl<C: Command> From<&C> for Message {
fn from(command: &C) -> Message {
Self::create(C::COMMAND_CODE, serialize(command).unwrap()).unwrap()
}
Expand Down
2 changes: 1 addition & 1 deletion src/connector/http/client/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Display for PathBuf {
}
}

impl<'a> From<&'a str> for PathBuf {
impl From<&str> for PathBuf {
fn from(path: &str) -> Self {
Self::from_str(path).unwrap()
}
Expand Down
2 changes: 1 addition & 1 deletion src/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl<'de> Deserialize<'de> for Domain {
{
struct DomainVisitor;

impl<'de> de::Visitor<'de> for DomainVisitor {
impl de::Visitor<'_> for DomainVisitor {
type Value = Domain;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion src/object/origins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl<'de> Deserialize<'de> for Origin {
{
struct OriginVisitor;

impl<'de> de::Visitor<'de> for OriginVisitor {
impl de::Visitor<'_> for OriginVisitor {
type Value = Origin;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion src/object/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl<'de> Deserialize<'de> for Type {
fn deserialize<D: de::Deserializer<'de>>(deserializer: D) -> Result<Type, D::Error> {
struct TypeVisitor;

impl<'de> de::Visitor<'de> for TypeVisitor {
impl de::Visitor<'_> for TypeVisitor {
type Value = Type;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
8 changes: 4 additions & 4 deletions src/serialization/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl<R: Read> Deserializer<R> {
}
}

impl<'de, 'a, R: Read> serde::Deserializer<'de> for &'a mut Deserializer<R> {
impl<'de, R: Read> serde::Deserializer<'de> for &mut Deserializer<R> {
type Error = Error;

#[inline]
Expand Down Expand Up @@ -184,7 +184,7 @@ impl<'de, 'a, R: Read> serde::Deserializer<'de> for &'a mut Deserializer<R> {
len: usize,
}

impl<'de, 'a, 'b: 'a, R: Read> SeqAccess<'de> for Access<'a, R> {
impl<'de, R: Read> SeqAccess<'de> for Access<'_, R> {
type Error = Error;

fn next_element_seed<T>(&mut self, seed: T) -> Result<Option<T::Value>, Error>
Expand Down Expand Up @@ -227,7 +227,7 @@ impl<'de, 'a, R: Read> serde::Deserializer<'de> for &'a mut Deserializer<R> {
deserializer: &'a mut Deserializer<R>,
}

impl<'de, 'a, 'b: 'a, R: Read> SeqAccess<'de> for Access<'a, R> {
impl<'de, R: Read> SeqAccess<'de> for Access<'_, R> {
type Error = Error;

fn next_element_seed<T>(&mut self, seed: T) -> Result<Option<T::Value>, Error>
Expand Down Expand Up @@ -309,7 +309,7 @@ impl<'de, 'a, R: Read> serde::Deserializer<'de> for &'a mut Deserializer<R> {
}
}

impl<'de, 'a, R: Read> serde::de::VariantAccess<'de> for &'a mut Deserializer<R> {
impl<'de, R: Read> serde::de::VariantAccess<'de> for &mut Deserializer<R> {
type Error = Error;

fn unit_variant(self) -> Result<(), Error> {
Expand Down
52 changes: 26 additions & 26 deletions src/serialization/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use serde::ser::{
SerializeMap, SerializeSeq, SerializeStruct, SerializeStructVariant, SerializeTuple,
SerializeTupleStruct, SerializeTupleVariant,
};
use std::{io::Write, u32};
use std::io::Write;

/// Serializer for `YubiHSM` messages
pub(crate) struct Serializer<W> {
Expand Down Expand Up @@ -97,9 +97,9 @@ impl<'a, W: Write> serde::Serializer for &'a mut Serializer<W> {
unimplemented!();
}

fn serialize_some<T: ?Sized>(self, _v: &T) -> Result<(), Error>
fn serialize_some<T>(self, _v: &T) -> Result<(), Error>
where
T: serde::Serialize,
T: serde::Serialize + ?Sized,
{
unimplemented!();
}
Expand Down Expand Up @@ -190,14 +190,14 @@ pub(crate) struct SerializeHelper<'a, W> {
ser: &'a mut Serializer<W>,
}

impl<'a, W: Write> SerializeSeq for SerializeHelper<'a, W> {
impl<W: Write> SerializeSeq for SerializeHelper<'_, W> {
type Ok = ();
type Error = Error;

#[inline]
fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), Error>
fn serialize_element<T>(&mut self, value: &T) -> Result<(), Error>
where
T: serde::Serialize,
T: serde::Serialize + ?Sized,
{
value.serialize(&mut *self.ser)
}
Expand All @@ -208,14 +208,14 @@ impl<'a, W: Write> SerializeSeq for SerializeHelper<'a, W> {
}
}

impl<'a, W: Write> SerializeTuple for SerializeHelper<'a, W> {
impl<W: Write> SerializeTuple for SerializeHelper<'_, W> {
type Ok = ();
type Error = Error;

#[inline]
fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), Error>
fn serialize_element<T>(&mut self, value: &T) -> Result<(), Error>
where
T: serde::Serialize,
T: serde::Serialize + ?Sized,
{
value.serialize(&mut *self.ser)
}
Expand All @@ -226,14 +226,14 @@ impl<'a, W: Write> SerializeTuple for SerializeHelper<'a, W> {
}
}

impl<'a, W: Write> SerializeTupleStruct for SerializeHelper<'a, W> {
impl<W: Write> SerializeTupleStruct for SerializeHelper<'_, W> {
type Ok = ();
type Error = Error;

#[inline]
fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), Error>
fn serialize_field<T>(&mut self, value: &T) -> Result<(), Error>
where
T: serde::Serialize,
T: serde::Serialize + ?Sized,
{
value.serialize(&mut *self.ser)
}
Expand All @@ -244,14 +244,14 @@ impl<'a, W: Write> SerializeTupleStruct for SerializeHelper<'a, W> {
}
}

impl<'a, W: Write> SerializeTupleVariant for SerializeHelper<'a, W> {
impl<W: Write> SerializeTupleVariant for SerializeHelper<'_, W> {
type Ok = ();
type Error = Error;

#[inline]
fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), Error>
fn serialize_field<T>(&mut self, value: &T) -> Result<(), Error>
where
T: serde::Serialize,
T: serde::Serialize + ?Sized,
{
value.serialize(&mut *self.ser)
}
Expand All @@ -262,22 +262,22 @@ impl<'a, W: Write> SerializeTupleVariant for SerializeHelper<'a, W> {
}
}

impl<'a, W: Write> SerializeMap for SerializeHelper<'a, W> {
impl<W: Write> SerializeMap for SerializeHelper<'_, W> {
type Ok = ();
type Error = Error;

#[inline]
fn serialize_key<K: ?Sized>(&mut self, value: &K) -> Result<(), Error>
fn serialize_key<K>(&mut self, value: &K) -> Result<(), Error>
where
K: serde::Serialize,
K: serde::Serialize + ?Sized,
{
value.serialize(&mut *self.ser)
}

#[inline]
fn serialize_value<V: ?Sized>(&mut self, value: &V) -> Result<(), Error>
fn serialize_value<V>(&mut self, value: &V) -> Result<(), Error>
where
V: serde::Serialize,
V: serde::Serialize + ?Sized,
{
value.serialize(&mut *self.ser)
}
Expand All @@ -288,14 +288,14 @@ impl<'a, W: Write> SerializeMap for SerializeHelper<'a, W> {
}
}

impl<'a, W: Write> SerializeStruct for SerializeHelper<'a, W> {
impl<W: Write> SerializeStruct for SerializeHelper<'_, W> {
type Ok = ();
type Error = Error;

#[inline]
fn serialize_field<T: ?Sized>(&mut self, _key: &'static str, value: &T) -> Result<(), Error>
fn serialize_field<T>(&mut self, _key: &'static str, value: &T) -> Result<(), Error>
where
T: serde::Serialize,
T: serde::Serialize + ?Sized,
{
value.serialize(&mut *self.ser)
}
Expand All @@ -306,14 +306,14 @@ impl<'a, W: Write> SerializeStruct for SerializeHelper<'a, W> {
}
}

impl<'a, W: Write> SerializeStructVariant for SerializeHelper<'a, W> {
impl<W: Write> SerializeStructVariant for SerializeHelper<'_, W> {
type Ok = ();
type Error = Error;

#[inline]
fn serialize_field<T: ?Sized>(&mut self, _key: &'static str, value: &T) -> Result<(), Error>
fn serialize_field<T>(&mut self, _key: &'static str, value: &T) -> Result<(), Error>
where
T: serde::Serialize,
T: serde::Serialize + ?Sized,
{
value.serialize(&mut *self.ser)
}
Expand Down
4 changes: 2 additions & 2 deletions src/session/guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ impl<'mutex> Guard<'mutex> {
}
}

impl<'mutex> Deref for Guard<'mutex> {
impl Deref for Guard<'_> {
type Target = Session;

fn deref(&self) -> &Session {
self.0.deref().as_ref().unwrap()
}
}

impl<'mutex> DerefMut for Guard<'mutex> {
impl DerefMut for Guard<'_> {
fn deref_mut(&mut self) -> &mut Session {
self.0.deref_mut().as_mut().unwrap()
}
Expand Down
2 changes: 1 addition & 1 deletion src/session/securechannel/challenge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Challenge {
}

/// Borrow the challenge value as a slice
#[cfg_attr(clippy, allow(clippy::trivially_copy_pass_by_ref))]
#[allow(clippy::trivially_copy_pass_by_ref)]
pub fn as_slice(&self) -> &[u8] {
&self.0
}
Expand Down
2 changes: 1 addition & 1 deletion src/wrap/nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl From<[u8; SIZE]> for Nonce {
}
}

impl<'a> From<&'a [u8]> for Nonce {
impl From<&[u8]> for Nonce {
fn from(bytes: &[u8]) -> Nonce {
assert_eq!(
bytes.len(),
Expand Down

0 comments on commit 8d07216

Please sign in to comment.