Skip to content

Commit

Permalink
fix some clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Dushistov committed Jul 17, 2024
1 parent 5b376d6 commit 3024ddb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion couchbase-lite/src/doc_enumerator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct DocumentInfo<'a, 'b> {
phantom: PhantomData<&'a DocEnumerator<'b>>,
}

impl<'a, 'b> DocumentInfo<'_, '_> {
impl DocumentInfo<'_, '_> {
pub(crate) fn new(inner: C4DocumentInfo) -> Self {
Self {
inner,
Expand Down
7 changes: 1 addition & 6 deletions couchbase-lite/src/replicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,7 @@ impl Replicator {
!ctx.is_null(),
"Replicator::call_on_status_changed: Internal error - null function pointer"
);
match ReplicatorState::try_from(status) {
Ok(state) => ((*ctx).state_cb)(state),
Err(err) => {
error!("replicator status change: invalid status {err}");
}
}
((*ctx).state_cb)(ReplicatorState::from(status));
});
if r.is_err() {
error!("Replicator::call_on_status_changed: catch panic aborting");
Expand Down
8 changes: 3 additions & 5 deletions couchbase-lite/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@ impl ValueRef<'_> {
ValueRef::UnsignedInt(FLValue_AsUnsigned(value))
} else if FLValue_IsInteger(value) {
ValueRef::SignedInt(FLValue_AsInt(value))
} else if FLValue_IsDouble(value) {
ValueRef::Double(FLValue_AsDouble(value))
} else {
if FLValue_IsDouble(value) {
ValueRef::Double(FLValue_AsDouble(value))
} else {
ValueRef::Float(FLValue_AsFloat(value))
}
ValueRef::Float(FLValue_AsFloat(value))
}
}
kFLString => {
Expand Down
16 changes: 8 additions & 8 deletions serde-fleece/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ impl<'a> ser::Serializer for &'a mut Serializer {
encoder_write!(self, FLEncoder_WriteNull)
}
#[inline]
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: ?Sized + Serialize,
{
value.serialize(&mut *self)
}
Expand All @@ -215,26 +215,26 @@ impl<'a> ser::Serializer for &'a mut Serializer {
encoder_write!(self, FLEncoder_WriteString, variant.into())
}
#[inline]
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: ?Sized + Serialize,
{
value.serialize(&mut *self)
}
#[inline]
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: ?Sized + Serialize,
{
encoder_write!(self, FLEncoder_BeginDict, 1)?;
encoder_write!(self, FLEncoder_WriteKey, variant.into())?;
Expand Down Expand Up @@ -301,9 +301,9 @@ impl<'a> ser::Serializer for &'a mut Serializer {
Ok(self)
}
#[inline]
fn collect_str<T: ?Sized>(self, value: &T) -> Result<Self::Ok, Self::Error>
fn collect_str<T>(self, value: &T) -> Result<Self::Ok, Self::Error>
where
T: Display,
T: ?Sized + Display,
{
self.serialize_str(&value.to_string())
}
Expand Down
8 changes: 4 additions & 4 deletions serde-fleece/src/ser/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ where
Err(Error::Unsupported("key must be a string (none)"))
}

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: ?Sized + Serialize,
{
Err(Error::Unsupported("key must be a string (some)"))
}
Expand Down Expand Up @@ -128,15 +128,15 @@ where
value.serialize(&mut *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: ?Sized + Serialize,
{
Err(Error::Unsupported("key must be a string (newtype variant)"))
}
Expand Down

0 comments on commit 3024ddb

Please sign in to comment.