Skip to content

Commit

Permalink
chore(ci): fix clippy warnings when using rust 1.83 (#1499)
Browse files Browse the repository at this point in the history
  • Loading branch information
koushiro authored Dec 2, 2024
1 parent 14dc823 commit c76e3c3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion core/src/server/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl BoundedWriter {
}
}

impl<'a> io::Write for &'a mut BoundedWriter {
impl io::Write for &mut BoundedWriter {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
let len = self.buf.len() + buf.len();
if self.max_len >= len {
Expand Down
2 changes: 1 addition & 1 deletion core/src/server/method_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ where
}
}

impl<'a, T> From<ErrorCode> for ResponsePayload<'a, T>
impl<T> From<ErrorCode> for ResponsePayload<'_, T>
where
T: Clone,
{
Expand Down
4 changes: 2 additions & 2 deletions types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ impl<'a> ErrorObject<'a> {
}
}

impl<'a> PartialEq for ErrorObject<'a> {
impl PartialEq for ErrorObject<'_> {
fn eq(&self, other: &Self) -> bool {
let this_raw = self.data.as_ref().map(|r| r.get());
let other_raw = other.data.as_ref().map(|r| r.get());
self.code == other.code && self.message == other.message && this_raw == other_raw
}
}

impl<'a> From<ErrorCode> for ErrorObject<'a> {
impl From<ErrorCode> for ErrorObject<'_> {
fn from(code: ErrorCode) -> Self {
Self { code, message: code.message().into(), data: None }
}
Expand Down
14 changes: 7 additions & 7 deletions types/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub struct TwoPointZero;

struct TwoPointZeroVisitor;

impl<'de> Visitor<'de> for TwoPointZeroVisitor {
impl Visitor<'_> for TwoPointZeroVisitor {
type Value = TwoPointZero;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -269,7 +269,7 @@ pub enum SubscriptionId<'a> {
Str(Cow<'a, str>),
}

impl<'a> From<SubscriptionId<'a>> for JsonValue {
impl From<SubscriptionId<'_>> for JsonValue {
fn from(sub_id: SubscriptionId) -> Self {
match sub_id {
SubscriptionId::Num(n) => n.into(),
Expand All @@ -278,13 +278,13 @@ impl<'a> From<SubscriptionId<'a>> for JsonValue {
}
}

impl<'a> From<u64> for SubscriptionId<'a> {
impl From<u64> for SubscriptionId<'_> {
fn from(sub_id: u64) -> Self {
Self::Num(sub_id)
}
}

impl<'a> From<String> for SubscriptionId<'a> {
impl From<String> for SubscriptionId<'_> {
fn from(sub_id: String) -> Self {
Self::Str(sub_id.into())
}
Expand All @@ -308,7 +308,7 @@ impl<'a> TryFrom<JsonValue> for SubscriptionId<'a> {
}
}

impl<'a> SubscriptionId<'a> {
impl SubscriptionId<'_> {
/// Convert `SubscriptionId<'a>` to `SubscriptionId<'static>` so that it can be moved across threads.
///
/// This can cause an allocation if the id is a string.
Expand Down Expand Up @@ -350,7 +350,7 @@ pub enum Id<'a> {
Str(Cow<'a, str>),
}

impl<'a> Id<'a> {
impl Id<'_> {
/// If the Id is a number, returns the associated number. Returns None otherwise.
pub fn as_number(&self) -> Option<&u64> {
match self {
Expand Down Expand Up @@ -396,7 +396,7 @@ impl<'a> Id<'a> {
}
}

impl<'a> std::fmt::Display for Id<'a> {
impl std::fmt::Display for Id<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Id::Null => f.write_str("null"),
Expand Down
8 changes: 4 additions & 4 deletions types/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<'a, T: Clone> Response<'a, T> {
}
}

impl<'a, T> fmt::Display for Response<'a, T>
impl<T> fmt::Display for Response<'_, T>
where
T: Serialize + Clone,
{
Expand All @@ -68,7 +68,7 @@ where
}
}

impl<'a, T> fmt::Debug for Response<'a, T>
impl<T> fmt::Debug for Response<'_, T>
where
T: Serialize + Clone,
{
Expand Down Expand Up @@ -205,7 +205,7 @@ where
{
struct FieldVisitor;

impl<'de> serde::de::Visitor<'de> for FieldVisitor {
impl serde::de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -313,7 +313,7 @@ where
}
}

impl<'a, T> Serialize for Response<'a, T>
impl<T> Serialize for Response<'_, T>
where
T: Serialize + Clone,
{
Expand Down

0 comments on commit c76e3c3

Please sign in to comment.