base: fix clippy::multiple_bound_locations lint

Merge the `where` clause bounds into the ones in the generic type
definitions. This is also more consistent with the other functions in
this file.

BUG=b:344974550
TEST=tools/clippy

Change-Id: Ie4d33ae0c204dab6279607aa0b181768b42c75eb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5599145
Reviewed-by: Elie Kheirallah <khei@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Daniel Verkamp 2024-05-16 17:41:34 -07:00 committed by crosvm LUCI
parent df6fc83b25
commit 75a3c8ab2e

View file

@ -19,14 +19,10 @@ use sync::Mutex;
/// NOTE: This does not validate already serialized Mutexes and data. If multiple structs contain a
/// clone of the Arc, and they are all being serialized, this will result in the same data being
/// serialized, once per clone.
pub fn serialize_arc_mutex<S, T: ?Sized>(
pub fn serialize_arc_mutex<S: Serializer, T: Serialize + ?Sized>(
item: &Arc<Mutex<T>>,
serializer: S,
) -> Result<S::Ok, S::Error>
where
S: Serializer,
T: Serialize,
{
) -> Result<S::Ok, S::Error> {
let lock = item.lock();
serde::Serialize::serialize(&*lock, serializer)
}