summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2023-04-08 09:56:45 +0200
committerMatthias Beyer <mail@beyermatthias.de>2023-04-08 09:56:45 +0200
commit3bc0ff8d3032b7a9416e8aeaa45a7d87d3466cdf (patch)
treeef13b97e1c223cb789c8c9a5bdd4a9e40b154b82 /src
parent02fb8fae8cacc016a6f70ae9a8f61bf5a7106c4b (diff)
Run cargo-fmt
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 9dfe3cf..228699c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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 {