Skip to content

Commit 568ff56

Browse files
committed
More fmt fixes
1 parent 5c7103a commit 568ff56

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/option_insert_result.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
// Similar to Option<T>.get_or_insert_with, for a function that returns a result.
22
pub trait OptionInsertWithResult<T> {
33
fn get_or_insert_with_result<F, E>(&mut self, f: F) -> Result<&T, E>
4-
where F: FnOnce() -> Result<T, E>;
4+
where
5+
F: FnOnce() -> Result<T, E>;
56
}
67

78
impl<T> OptionInsertWithResult<T> for Option<T> {
89
fn get_or_insert_with_result<F, E>(&mut self, f: F) -> Result<&T, E>
9-
where F: FnOnce() -> Result<T, E>
10+
where
11+
F: FnOnce() -> Result<T, E>,
1012
{
1113
if self.is_none() {
1214
*self = Some(f()?);
1315
}
1416
Ok(self.as_ref().unwrap())
1517
}
16-
}
18+
}

0 commit comments

Comments
 (0)