Skip to content

Commit

Permalink
fix: update ci actions triggers (#271)
Browse files Browse the repository at this point in the history
* fix: update ci actions triggers

* chore: handle breaking changes

* chore: handle clippy errors
  • Loading branch information
buinauskas authored Jul 5, 2024
1 parent 2e95001 commit 4e145bb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 39 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
on:
push:
branches: [master]
pull_request:
types: [opened]
branches: [master]

name: Rust

Expand Down
54 changes: 23 additions & 31 deletions src/search/params/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ impl ser::Serializer for Serializer {
Err(TermSerializeError::NoTerm)
}

fn serialize_some<T: ?Sized>(self, value: &T) -> Result<Self::Ok, Self::Error>
fn serialize_some<T>(self, value: &T) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
value.serialize(self)
}
Expand All @@ -179,26 +179,26 @@ impl ser::Serializer for Serializer {
self.serialize_str(variant)
}

fn serialize_newtype_struct<T: ?Sized>(
fn serialize_newtype_struct<T>(
self,
_name: &'static str,
value: &T,
) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
value.serialize(self)
}

fn serialize_newtype_variant<T: ?Sized>(
fn serialize_newtype_variant<T>(
self,
_name: &'static str,
_variant_index: u32,
_variant: &'static str,
_value: &T,
) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(TermSerializeError::NotTerm)
}
Expand Down Expand Up @@ -256,9 +256,9 @@ impl ser::SerializeSeq for Serializer {
type Ok = Term;
type Error = TermSerializeError;

fn serialize_element<T: ?Sized>(&mut self, _value: &T) -> Result<(), Self::Error>
fn serialize_element<T>(&mut self, _value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(TermSerializeError::NotTerm)
}
Expand All @@ -272,9 +272,9 @@ impl ser::SerializeTuple for Serializer {
type Ok = Term;
type Error = TermSerializeError;

fn serialize_element<T: ?Sized>(&mut self, _value: &T) -> Result<(), Self::Error>
fn serialize_element<T>(&mut self, _value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(TermSerializeError::NotTerm)
}
Expand All @@ -288,9 +288,9 @@ impl ser::SerializeTupleStruct for Serializer {
type Ok = Term;
type Error = TermSerializeError;

fn serialize_field<T: ?Sized>(&mut self, _value: &T) -> Result<(), Self::Error>
fn serialize_field<T>(&mut self, _value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(TermSerializeError::NotTerm)
}
Expand All @@ -303,9 +303,9 @@ impl ser::SerializeTupleVariant for Serializer {
type Ok = Term;
type Error = TermSerializeError;

fn serialize_field<T: ?Sized>(&mut self, _value: &T) -> Result<(), Self::Error>
fn serialize_field<T>(&mut self, _value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(TermSerializeError::NotTerm)
}
Expand All @@ -319,16 +319,16 @@ impl ser::SerializeMap for Serializer {
type Ok = Term;
type Error = TermSerializeError;

fn serialize_key<T: ?Sized>(&mut self, _key: &T) -> Result<(), Self::Error>
fn serialize_key<T>(&mut self, _key: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(TermSerializeError::NotTerm)
}

fn serialize_value<T: ?Sized>(&mut self, _value: &T) -> Result<(), Self::Error>
fn serialize_value<T>(&mut self, _value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(TermSerializeError::NotTerm)
}
Expand All @@ -342,13 +342,9 @@ impl ser::SerializeStruct for Serializer {
type Ok = Term;
type Error = TermSerializeError;

fn serialize_field<T: ?Sized>(
&mut self,
_key: &'static str,
_value: &T,
) -> Result<(), Self::Error>
fn serialize_field<T>(&mut self, _key: &'static str, _value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(TermSerializeError::NotTerm)
}
Expand All @@ -362,13 +358,9 @@ impl ser::SerializeStructVariant for Serializer {
type Ok = Term;
type Error = TermSerializeError;

fn serialize_field<T: ?Sized>(
&mut self,
_key: &'static str,
_value: &T,
) -> Result<(), Self::Error>
fn serialize_field<T>(&mut self, _key: &'static str, _value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(TermSerializeError::NotTerm)
}
Expand Down Expand Up @@ -399,7 +391,7 @@ impl std::fmt::Display for TermSerializeError {

impl std::error::Error for TermSerializeError {}

impl serde::ser::Error for TermSerializeError {
impl ser::Error for TermSerializeError {
fn custom<T>(_msg: T) -> Self
where
T: std::fmt::Display,
Expand Down
14 changes: 7 additions & 7 deletions src/search/sort/sort_special_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ pub enum SortSpecialField {
ShardDocumentOrder,
}

impl ToString for SortSpecialField {
fn to_string(&self) -> String {
String::from(match self {
Self::Score => "_score",
Self::DocumentIndexOrder => "_doc",
Self::ShardDocumentOrder => "_shard_doc",
})
impl std::fmt::Display for SortSpecialField {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Self::Score => "_score".fmt(f),
Self::DocumentIndexOrder => "_doc".fmt(f),
Self::ShardDocumentOrder => "_shard_doc".fmt(f),
}
}
}

0 comments on commit 4e145bb

Please sign in to comment.