diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2023-04-08 09:56:45 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2023-04-08 09:56:45 +0200 |
commit | 3bc0ff8d3032b7a9416e8aeaa45a7d87d3466cdf (patch) | |
tree | ef13b97e1c223cb789c8c9a5bdd4a9e40b154b82 /src | |
parent | 02fb8fae8cacc016a6f70ae9a8f61bf5a7106c4b (diff) |
Run cargo-fmt
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 33 |
1 files changed, 20 insertions, 13 deletions
@@ -2,22 +2,25 @@ //! pub trait OptionInspect<F, T> - where F: FnOnce(&T), - T: Sized +where + F: FnOnce(&T), + T: Sized, { fn inspect(self, f: F) -> Self; } pub trait OptionInspectRef<F, T> - where F: FnOnce(&T), - T: Sized +where + F: FnOnce(&T), + T: Sized, { fn inspect(&self, f: F); } impl<F, T> OptionInspect<F, T> for Option<T> - where F: FnOnce(&T), - T: Sized +where + F: FnOnce(&T), + T: Sized, { fn inspect(self, f: F) -> Self { if let Some(ref o) = self.as_ref() { @@ -29,8 +32,9 @@ impl<F, T> OptionInspect<F, T> for Option<T> } impl<F, T> OptionInspectRef<F, T> for Option<T> - where F: FnOnce(&T), - T: Sized +where + F: FnOnce(&T), + T: Sized, { fn inspect(&self, f: F) { if let Some(ref o) = self { @@ -39,21 +43,23 @@ impl<F, T> OptionInspectRef<F, T> for Option<T> } } - pub trait OptionInspectNone<F> - where F: FnOnce(), +where + F: FnOnce(), { fn inspect_none(self, f: F) -> Self; } pub trait OptionInspectNoneRef<F> - where F: FnOnce(), +where + F: FnOnce(), { fn inspect_none(&self, f: F); } impl<F, T> OptionInspectNone<F> for Option<T> - where F: FnOnce() +where + F: FnOnce(), { fn inspect_none(self, f: F) -> Self { if let None = self.as_ref() { @@ -65,7 +71,8 @@ impl<F, T> OptionInspectNone<F> for Option<T> } impl<F, T> OptionInspectNoneRef<F> for Option<T> - where F: FnOnce() +where + F: FnOnce(), { fn inspect_none(&self, f: F) { if let None = self { |