diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-08-19 21:12:34 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-08-19 21:12:34 +0200 |
| commit | 141d69cb60d4f565f06ccd4ebeb353e748fadb7f (patch) | |
| tree | f8fe203a6ed2aedc46a8f7e975bd16671476e58b /src/prelude.rs | |
| parent | fd9959fd04739c1dab2ea1a899a17c94e0892103 (diff) | |
Remove some obsolete stuff ❌
Diffstat (limited to 'src/prelude.rs')
| -rw-r--r-- | src/prelude.rs | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/prelude.rs b/src/prelude.rs index 214b00c8..7dd6be30 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -10,28 +10,3 @@ pub use crate::syntax::span::{Pos, Span, SpanVec, Spanned}; pub use crate::syntax::tree::*; pub use crate::{Pass, Feedback}; pub use super::*; - -/// Extra methods on `Option`s used for function argument parsing. -pub trait OptionExt<T>: Sized { - /// Call `f` with `val` if this is `Some(val)`. - fn with(self, f: impl FnOnce(T)); - - /// Report an error about a missing argument with the given name and span if - /// the option is `None`. - fn or_missing(self, span: Span, arg: &str, f: &mut Feedback) -> Self; -} - -impl<T> OptionExt<T> for Option<T> { - fn with(self, f: impl FnOnce(T)) { - if let Some(val) = self { - f(val); - } - } - - fn or_missing(self, span: Span, arg: &str, f: &mut Feedback) -> Self { - if self.is_none() { - error!(@f, span, "missing argument: {}", arg); - } - self - } -} |
