Skip to content

Commit ffedab5

Browse files
authored
Merge pull request #69 from eopb/push-xnwtxvrquypp
chore: run `cargo-fmt`
2 parents 81f195b + 5235d9d commit ffedab5

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

src/serde.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,48 @@ pub trait SerializableSecret<T> {
2424
}
2525

2626
impl<T: Serialize> SerializableSecret<T> for &Secret<T> {
27-
type Exposed<'a> = &'a T where T: 'a, Self: 'a;
27+
type Exposed<'a>
28+
= &'a T
29+
where
30+
T: 'a,
31+
Self: 'a;
2832

2933
fn expose_via(&self, expose: impl Fn(&Secret<T>) -> &T) -> Self::Exposed<'_> {
3034
expose(self)
3135
}
3236
}
3337

3438
impl<T: Serialize> SerializableSecret<T> for Secret<T> {
35-
type Exposed<'a> = &'a T where T: 'a;
39+
type Exposed<'a>
40+
= &'a T
41+
where
42+
T: 'a;
3643

3744
fn expose_via(&self, expose: impl Fn(&Secret<T>) -> &T) -> Self::Exposed<'_> {
3845
expose(self)
3946
}
4047
}
4148

4249
impl<T: Serialize> SerializableSecret<T> for Option<Secret<T>> {
43-
type Exposed<'a> = Option<&'a T> where T: 'a;
50+
type Exposed<'a>
51+
= Option<&'a T>
52+
where
53+
T: 'a;
4454

4555
fn expose_via(&self, expose: impl Fn(&Secret<T>) -> &T) -> Self::Exposed<'_> {
4656
self.as_ref().map(expose)
4757
}
4858
}
4959

5060
#[cfg(feature = "std")]
51-
impl<T: Serialize> SerializableSecret<T> for Vec<Secret<T>> where for<'a> Vec<&'a T>: Serialize {
52-
type Exposed<'a> = Vec<&'a T> where T: 'a;
61+
impl<T: Serialize> SerializableSecret<T> for Vec<Secret<T>>
62+
where
63+
for<'a> Vec<&'a T>: Serialize,
64+
{
65+
type Exposed<'a>
66+
= Vec<&'a T>
67+
where
68+
T: 'a;
5369

5470
fn expose_via(&self, expose: impl Fn(&Secret<T>) -> &T) -> Self::Exposed<'_> {
5571
self.iter().map(expose).collect()

0 commit comments

Comments
 (0)