Skip to content

Commit

Permalink
style: Make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Nov 29, 2024
1 parent 96603b9 commit c640b09
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 89 deletions.
6 changes: 3 additions & 3 deletions crates/core/src/model/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl<T: ValueView> ArrayView for Vec<T> {
}
}

impl<'a, A: ArrayView + ?Sized> ArrayView for &'a A {
impl<A: ArrayView + ?Sized> ArrayView for &A {
fn as_value(&self) -> &dyn ValueView {
<A as ArrayView>::as_value(self)
}
Expand Down Expand Up @@ -136,7 +136,7 @@ struct ArraySource<'s, T: ValueView> {
s: &'s Vec<T>,
}

impl<'s, T: ValueView> fmt::Display for ArraySource<'s, T> {
impl<T: ValueView> fmt::Display for ArraySource<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[")?;
for item in self.s {
Expand All @@ -151,7 +151,7 @@ struct ArrayRender<'s, T: ValueView> {
s: &'s Vec<T>,
}

impl<'s, T: ValueView> fmt::Display for ArrayRender<'s, T> {
impl<T: ValueView> fmt::Display for ArrayRender<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for item in self.s {
write!(f, "{}", item.render())?;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/model/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl<'s> AsRef<[ScalarCow<'s>]> for Path<'s> {
}
}

impl<'s> fmt::Display for Path<'s> {
impl fmt::Display for Path<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let data = itertools::join(self.iter().map(ValueView::render), ".");
write!(f, "{}", data)
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/model/object/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl Object {
/// }
/// # ;
/// ```
impl<'a, Q: ?Sized> ops::Index<&'a Q> for Object
impl<Q: ?Sized> ops::Index<&Q> for Object
where
Key: Borrow<Q>,
Q: Ord + Eq + Hash,
Expand All @@ -212,7 +212,7 @@ where
/// #
/// map["key"] = liquid_core::value!("value");
/// ```
impl<'a, Q: ?Sized> ops::IndexMut<&'a Q> for Object
impl<Q: ?Sized> ops::IndexMut<&Q> for Object
where
Key: Borrow<Q>,
Q: Ord + Eq + Hash,
Expand Down
10 changes: 5 additions & 5 deletions crates/core/src/model/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl ObjectView for Object {
}
}

impl<'o, O: ObjectView + ?Sized> ObjectView for &'o O {
impl<O: ObjectView + ?Sized> ObjectView for &O {
fn as_value(&self) -> &dyn ValueView {
<O as ObjectView>::as_value(self)
}
Expand Down Expand Up @@ -154,13 +154,13 @@ impl ObjectIndex for crate::model::KString {
}
}

impl<'s> ObjectIndex for crate::model::KStringRef<'s> {
impl ObjectIndex for crate::model::KStringRef<'_> {
fn as_index(&self) -> &str {
self.as_str()
}
}

impl<'s> ObjectIndex for crate::model::KStringCow<'s> {
impl ObjectIndex for crate::model::KStringCow<'_> {
fn as_index(&self) -> &str {
self.as_str()
}
Expand Down Expand Up @@ -325,7 +325,7 @@ impl<'s, O: ObjectView> ObjectSource<'s, O> {
}
}

impl<'s, O: ObjectView> fmt::Display for ObjectSource<'s, O> {
impl<O: ObjectView> fmt::Display for ObjectSource<'_, O> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{{")?;
for (k, v) in self.s.iter() {
Expand All @@ -349,7 +349,7 @@ impl<'s, O: ObjectView> ObjectRender<'s, O> {
}
}

impl<'s, O: ObjectView> fmt::Display for ObjectRender<'s, O> {
impl<O: ObjectView> fmt::Display for ObjectRender<'_, O> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for (k, v) in self.s.iter() {
write!(f, "{}{}", k, v.render())?;
Expand Down
60 changes: 30 additions & 30 deletions crates/core/src/model/scalar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ impl<'s> ScalarCow<'s> {
}
}

impl<'s> fmt::Debug for ScalarCow<'s> {
impl fmt::Debug for ScalarCow<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.0, f)
}
}

impl<'s> ValueView for ScalarCow<'s> {
impl ValueView for ScalarCow<'_> {
fn as_debug(&self) -> &dyn fmt::Debug {
self
}
Expand Down Expand Up @@ -233,20 +233,20 @@ impl ValueView for i64 {
}
}

impl<'s> From<i64> for ScalarCow<'s> {
impl From<i64> for ScalarCow<'_> {
fn from(s: i64) -> Self {
ScalarCow(ScalarCowEnum::Integer(s))
}
}

impl<'s> PartialEq<i64> for ScalarCow<'s> {
impl PartialEq<i64> for ScalarCow<'_> {
fn eq(&self, other: &i64) -> bool {
let other = (*other).into();
scalar_eq(self, &other)
}
}

impl<'s> PartialOrd<i64> for ScalarCow<'s> {
impl PartialOrd<i64> for ScalarCow<'_> {
fn partial_cmp(&self, other: &i64) -> Option<Ordering> {
let other = (*other).into();
scalar_cmp(self, &other)
Expand Down Expand Up @@ -349,20 +349,20 @@ impl ValueView for f64 {
}
}

impl<'s> From<f64> for ScalarCow<'s> {
impl From<f64> for ScalarCow<'_> {
fn from(s: f64) -> Self {
ScalarCow(ScalarCowEnum::Float(s))
}
}

impl<'s> PartialEq<f64> for ScalarCow<'s> {
impl PartialEq<f64> for ScalarCow<'_> {
fn eq(&self, other: &f64) -> bool {
let other = (*other).into();
scalar_eq(self, &other)
}
}

impl<'s> PartialOrd<f64> for ScalarCow<'s> {
impl PartialOrd<f64> for ScalarCow<'_> {
fn partial_cmp(&self, other: &f64) -> Option<Ordering> {
let other = (*other).into();
scalar_cmp(self, &other)
Expand Down Expand Up @@ -406,20 +406,20 @@ impl ValueView for bool {
}
}

impl<'s> From<bool> for ScalarCow<'s> {
impl From<bool> for ScalarCow<'_> {
fn from(s: bool) -> Self {
ScalarCow(ScalarCowEnum::Bool(s))
}
}

impl<'s> PartialEq<bool> for ScalarCow<'s> {
impl PartialEq<bool> for ScalarCow<'_> {
fn eq(&self, other: &bool) -> bool {
let other = (*other).into();
scalar_eq(self, &other)
}
}

impl<'s> PartialOrd<bool> for ScalarCow<'s> {
impl PartialOrd<bool> for ScalarCow<'_> {
fn partial_cmp(&self, other: &bool) -> Option<Ordering> {
let other = (*other).into();
scalar_cmp(self, &other)
Expand Down Expand Up @@ -461,20 +461,20 @@ impl ValueView for DateTime {
}
}

impl<'s> From<DateTime> for ScalarCow<'s> {
impl From<DateTime> for ScalarCow<'_> {
fn from(s: DateTime) -> Self {
ScalarCow(ScalarCowEnum::DateTime(s))
}
}

impl<'s> PartialEq<DateTime> for ScalarCow<'s> {
impl PartialEq<DateTime> for ScalarCow<'_> {
fn eq(&self, other: &DateTime) -> bool {
let other = (*other).into();
scalar_eq(self, &other)
}
}

impl<'s> PartialOrd<DateTime> for ScalarCow<'s> {
impl PartialOrd<DateTime> for ScalarCow<'_> {
fn partial_cmp(&self, other: &DateTime) -> Option<Ordering> {
let other = (*other).into();
scalar_cmp(self, &other)
Expand Down Expand Up @@ -516,27 +516,27 @@ impl ValueView for Date {
}
}

impl<'s> From<Date> for ScalarCow<'s> {
impl From<Date> for ScalarCow<'_> {
fn from(s: Date) -> Self {
ScalarCow(ScalarCowEnum::Date(s))
}
}

impl<'s> PartialEq<Date> for ScalarCow<'s> {
impl PartialEq<Date> for ScalarCow<'_> {
fn eq(&self, other: &Date) -> bool {
let other = (*other).into();
scalar_eq(self, &other)
}
}

impl<'s> PartialOrd<Date> for ScalarCow<'s> {
impl PartialOrd<Date> for ScalarCow<'_> {
fn partial_cmp(&self, other: &Date) -> Option<Ordering> {
let other = (*other).into();
scalar_cmp(self, &other)
}
}

impl<'s> ValueView for &'s str {
impl ValueView for &str {
fn as_debug(&self) -> &dyn fmt::Debug {
self
}
Expand Down Expand Up @@ -575,7 +575,7 @@ struct StrSource<'s> {
s: &'s str,
}

impl<'s> fmt::Display for StrSource<'s> {
impl fmt::Display for StrSource<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, r#""{}""#, self.s)
}
Expand All @@ -587,7 +587,7 @@ impl<'s> From<&'s str> for ScalarCow<'s> {
}
}

impl<'s> PartialEq<str> for ScalarCow<'s> {
impl PartialEq<str> for ScalarCow<'_> {
fn eq(&self, other: &str) -> bool {
let other = other.into();
scalar_eq(self, &other)
Expand All @@ -601,7 +601,7 @@ impl<'s> PartialEq<&'s str> for ScalarCow<'s> {
}
}

impl<'s> PartialOrd<str> for ScalarCow<'s> {
impl PartialOrd<str> for ScalarCow<'_> {
fn partial_cmp(&self, other: &str) -> Option<Ordering> {
let other = other.into();
scalar_cmp(self, &other)
Expand Down Expand Up @@ -638,7 +638,7 @@ impl ValueView for String {
}
}

impl<'s> From<String> for ScalarCow<'s> {
impl From<String> for ScalarCow<'_> {
fn from(s: String) -> Self {
ScalarCow(ScalarCowEnum::Str(s.into()))
}
Expand All @@ -650,14 +650,14 @@ impl<'s> From<&'s String> for ScalarCow<'s> {
}
}

impl<'s> PartialEq<String> for ScalarCow<'s> {
impl PartialEq<String> for ScalarCow<'_> {
fn eq(&self, other: &String) -> bool {
let other = other.into();
scalar_eq(self, &other)
}
}

impl<'s> PartialOrd<String> for ScalarCow<'s> {
impl PartialOrd<String> for ScalarCow<'_> {
fn partial_cmp(&self, other: &String) -> Option<Ordering> {
let other = other.into();
scalar_cmp(self, &other)
Expand Down Expand Up @@ -694,7 +694,7 @@ impl ValueView for KString {
}
}

impl<'s> From<KString> for ScalarCow<'s> {
impl From<KString> for ScalarCow<'_> {
fn from(s: KString) -> Self {
ScalarCow(ScalarCowEnum::Str(s.into()))
}
Expand All @@ -706,21 +706,21 @@ impl<'s> From<&'s KString> for ScalarCow<'s> {
}
}

impl<'s> PartialEq<KString> for ScalarCow<'s> {
impl PartialEq<KString> for ScalarCow<'_> {
fn eq(&self, other: &KString) -> bool {
let other = other.into();
scalar_eq(self, &other)
}
}

impl<'s> PartialOrd<KString> for ScalarCow<'s> {
impl PartialOrd<KString> for ScalarCow<'_> {
fn partial_cmp(&self, other: &KString) -> Option<Ordering> {
let other = other.into();
scalar_cmp(self, &other)
}
}

impl<'s> ValueView for KStringCow<'s> {
impl ValueView for KStringCow<'_> {
fn as_debug(&self) -> &dyn fmt::Debug {
self
}
Expand Down Expand Up @@ -776,7 +776,7 @@ impl<'s> PartialOrd<KStringCow<'s>> for ScalarCow<'s> {
}
}

impl<'s> ValueView for KStringRef<'s> {
impl ValueView for KStringRef<'_> {
fn as_debug(&self) -> &dyn fmt::Debug {
self
}
Expand Down Expand Up @@ -832,7 +832,7 @@ impl<'s> PartialOrd<KStringRef<'s>> for ScalarCow<'s> {
}
}

impl<'s> Eq for ScalarCow<'s> {}
impl Eq for ScalarCow<'_> {}

fn scalar_eq<'s>(lhs: &ScalarCow<'s>, rhs: &ScalarCow<'s>) -> bool {
match (&lhs.0, &rhs.0) {
Expand Down
Loading

0 comments on commit c640b09

Please sign in to comment.