Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Satisfy clippy on latest toolchain #481

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 25 additions & 29 deletions insta/src/content/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ where
Ok(Content::None)
}

fn serialize_some<T: ?Sized>(self, value: &T) -> Result<Content, E>
fn serialize_some<T>(self, value: &T) -> Result<Content, E>
where
T: Serialize,
T: Serialize + ?Sized,
{
Ok(Content::Some(Box::new(value.serialize(self)?)))
}
Expand All @@ -267,29 +267,25 @@ where
Ok(Content::UnitVariant(name, variant_index, variant))
}

fn serialize_newtype_struct<T: ?Sized>(
self,
name: &'static str,
value: &T,
) -> Result<Content, E>
fn serialize_newtype_struct<T>(self, name: &'static str, value: &T) -> Result<Content, E>
where
T: Serialize,
T: Serialize + ?Sized,
{
Ok(Content::NewtypeStruct(
name,
Box::new(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<Content, E>
where
T: Serialize,
T: Serialize + ?Sized,
{
Ok(Content::NewtypeVariant(
name,
Expand Down Expand Up @@ -386,9 +382,9 @@ where
type Ok = Content;
type Error = E;

fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), E>
fn serialize_element<T>(&mut self, value: &T) -> Result<(), E>
where
T: Serialize,
T: Serialize + ?Sized,
{
let value = value.serialize(ContentSerializer::<E>::new())?;
self.elements.push(value);
Expand All @@ -412,9 +408,9 @@ where
type Ok = Content;
type Error = E;

fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), E>
fn serialize_element<T>(&mut self, value: &T) -> Result<(), E>
where
T: Serialize,
T: Serialize + ?Sized,
{
let value = value.serialize(ContentSerializer::<E>::new())?;
self.elements.push(value);
Expand All @@ -439,9 +435,9 @@ where
type Ok = Content;
type Error = E;

fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), E>
fn serialize_field<T>(&mut self, value: &T) -> Result<(), E>
where
T: Serialize,
T: Serialize + ?Sized,
{
let value = value.serialize(ContentSerializer::<E>::new())?;
self.fields.push(value);
Expand All @@ -468,9 +464,9 @@ where
type Ok = Content;
type Error = E;

fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), E>
fn serialize_field<T>(&mut self, value: &T) -> Result<(), E>
where
T: Serialize,
T: Serialize + ?Sized,
{
let value = value.serialize(ContentSerializer::<E>::new())?;
self.fields.push(value);
Expand Down Expand Up @@ -500,18 +496,18 @@ where
type Ok = Content;
type Error = E;

fn serialize_key<T: ?Sized>(&mut self, key: &T) -> Result<(), E>
fn serialize_key<T>(&mut self, key: &T) -> Result<(), E>
where
T: Serialize,
T: Serialize + ?Sized,
{
let key = key.serialize(ContentSerializer::<E>::new())?;
self.key = Some(key);
Ok(())
}

fn serialize_value<T: ?Sized>(&mut self, value: &T) -> Result<(), E>
fn serialize_value<T>(&mut self, value: &T) -> Result<(), E>
where
T: Serialize,
T: Serialize + ?Sized,
{
let key = self
.key
Expand All @@ -526,10 +522,10 @@ where
Ok(Content::Map(self.entries))
}

fn serialize_entry<K: ?Sized, V: ?Sized>(&mut self, key: &K, value: &V) -> Result<(), E>
fn serialize_entry<K, V>(&mut self, key: &K, value: &V) -> Result<(), E>
where
K: Serialize,
V: Serialize,
K: Serialize + ?Sized,
V: Serialize + ?Sized,
{
let key = key.serialize(ContentSerializer::<E>::new())?;
let value = value.serialize(ContentSerializer::<E>::new())?;
Expand All @@ -551,9 +547,9 @@ where
type Ok = Content;
type Error = E;

fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<(), E>
fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<(), E>
where
T: Serialize,
T: Serialize + ?Sized,
{
let value = value.serialize(ContentSerializer::<E>::new())?;
self.fields.push((key, value));
Expand All @@ -580,9 +576,9 @@ where
type Ok = Content;
type Error = E;

fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<(), E>
fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<(), E>
where
T: Serialize,
T: Serialize + ?Sized,
{
let value = value.serialize(ContentSerializer::<E>::new())?;
self.fields.push((key, value));
Expand Down
2 changes: 1 addition & 1 deletion insta/src/content/yaml/vendored/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
suffix = self.scan_tag_uri(false, secondary, "", &start_mark)?;
} else {
suffix = self.scan_tag_uri(false, false, &handle, &start_mark)?;
handle = "!".to_owned();
handle = "!".to_string();
// A special case: the '!' tag. Set the handle to '' and the
// suffix to '!'.
if suffix.is_empty() {
Expand Down
Loading