Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
PSeitz committed Oct 28, 2024
1 parent 6654cd9 commit 8c32ff6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ use serde::Deserializer;
use crate::value::N;
use crate::{KeyStrType, Value};

impl<'de, 'ctx> IntoDeserializer<'de, de::value::Error> for &'de Value<'ctx> {
impl<'de> IntoDeserializer<'de, de::value::Error> for &'de Value<'_> {
type Deserializer = Self;

fn into_deserializer(self) -> Self::Deserializer {
self
}
}

impl<'ctx, 'de> Deserializer<'de> for &'de Value<'ctx> {
impl<'de> Deserializer<'de> for &'de Value<'_> {
type Error = de::value::Error;

fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
Expand Down
4 changes: 2 additions & 2 deletions src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::owned::OwnedValue;
use crate::value::{Number, Value, N};
use crate::Map;

impl<'ctx> Serialize for Value<'ctx> {
impl Serialize for Value<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer {
match self {
Expand All @@ -17,7 +17,7 @@ impl<'ctx> Serialize for Value<'ctx> {
}
}
}
impl<'ctx> Serialize for Map<'ctx> {
impl Serialize for Map<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer {
serializer.collect_map(self.iter())
Expand Down
22 changes: 11 additions & 11 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl<'ctx> Value<'ctx> {
}
}

impl<'a> From<bool> for Value<'a> {
impl From<bool> for Value<'_> {
fn from(val: bool) -> Self {
Value::Bool(val)
}
Expand All @@ -256,7 +256,7 @@ impl<'a> From<&'a str> for Value<'a> {
}
}

impl<'a> From<String> for Value<'a> {
impl From<String> for Value<'_> {
fn from(val: String) -> Self {
Value::Str(Cow::Owned(val))
}
Expand All @@ -274,7 +274,7 @@ impl<'a, T: Clone + Into<Value<'a>>> From<&[T]> for Value<'a> {
}
}

impl<'ctx> Debug for Value<'ctx> {
impl Debug for Value<'_> {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
match self {
Value::Null => formatter.write_str("Null"),
Expand Down Expand Up @@ -339,7 +339,7 @@ impl Number {
pub fn as_i64(&self) -> Option<i64> {
match self.n {
N::PosInt(n) => {
if n <= i64::max_value() as u64 {
if n <= i64::MAX as u64 {
Some(n as i64)
} else {
None
Expand Down Expand Up @@ -373,7 +373,7 @@ impl Number {
/// `i64::MAX`.
pub fn is_i64(&self) -> bool {
match self.n {
N::PosInt(v) => v <= i64::max_value() as u64,
N::PosInt(v) => v <= i64::MAX as u64,
N::NegInt(_) => true,
N::Float(_) => false,
}
Expand Down Expand Up @@ -413,19 +413,19 @@ impl Hash for N {
}
}

impl<'a> From<u64> for Value<'a> {
impl From<u64> for Value<'_> {
fn from(val: u64) -> Self {
Value::Number(val.into())
}
}

impl<'a> From<i64> for Value<'a> {
impl From<i64> for Value<'_> {
fn from(val: i64) -> Self {
Value::Number(val.into())
}
}

impl<'a> From<f64> for Value<'a> {
impl From<f64> for Value<'_> {
fn from(val: f64) -> Self {
Value::Number(val.into())
}
Expand Down Expand Up @@ -459,7 +459,7 @@ impl From<Number> for serde_json::value::Number {
}
}

impl<'ctx> From<Value<'ctx>> for serde_json::Value {
impl From<Value<'_>> for serde_json::Value {
fn from(val: Value) -> Self {
match val {
Value::Null => serde_json::Value::Null,
Expand All @@ -474,7 +474,7 @@ impl<'ctx> From<Value<'ctx>> for serde_json::Value {
}
}

impl<'ctx> From<&Value<'ctx>> for serde_json::Value {
impl From<&Value<'_>> for serde_json::Value {
fn from(val: &Value) -> Self {
match val {
Value::Null => serde_json::Value::Null,
Expand Down Expand Up @@ -515,7 +515,7 @@ impl<'ctx> From<&'ctx serde_json::Value> for Value<'ctx> {
for (k, v) in obj {
ans.insert(k.as_str(), v.into());
}
Value::Object(ObjectAsVec::from(ans))
Value::Object(ans)
}
}
}
Expand Down

0 comments on commit 8c32ff6

Please sign in to comment.