Skip to content

Commit

Permalink
Resolve type_repetition_in_bounds clippy lint
Browse files Browse the repository at this point in the history
    error: this type has already been used as a bound predicate
       --> src/value/ser.rs:278:9
        |
    278 |         T: Display,
        |         ^^^^^^^^^^
        |
        = note: `-D clippy::type-repetition-in-bounds` implied by `-D clippy::pedantic`
        = help: consider combining the bounds: `T: Sized + Display`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> src/value/ser.rs:611:9
        |
    611 |         T: Display,
        |         ^^^^^^^^^^
        |
        = help: consider combining the bounds: `T: Sized + Display`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds
  • Loading branch information
dtolnay committed May 1, 2022
1 parent 585e4c5 commit 048a64c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/value/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ impl serde::Serializer for Serializer {
})
}

fn collect_str<T: ?Sized>(self, value: &T) -> Result<Value>
fn collect_str<T>(self, value: &T) -> Result<Value>
where
T: Display,
T: ?Sized + Display,
{
Ok(Value::String(value.to_string()))
}
Expand Down Expand Up @@ -606,9 +606,9 @@ impl serde::Serializer for MapKeySerializer {
Err(key_must_be_a_string())
}

fn collect_str<T: ?Sized>(self, value: &T) -> Result<String>
fn collect_str<T>(self, value: &T) -> Result<String>
where
T: Display,
T: ?Sized + Display,
{
Ok(value.to_string())
}
Expand Down

0 comments on commit 048a64c

Please sign in to comment.