diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-12-13 14:58:14 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-12-13 14:58:14 +0100 |
| commit | 971ff3a2dcff1e68bf7e19017113469aad5a30c2 (patch) | |
| tree | f6776688446f278882947f713401b9a92b8e9384 /src/library/maps.rs | |
| parent | f549914ff8d66e48e779d4d99898a224bd1ab701 (diff) | |
Implement expression kind for Spanned<T> 👩💻
Diffstat (limited to 'src/library/maps.rs')
| -rw-r--r-- | src/library/maps.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/library/maps.rs b/src/library/maps.rs index 4eafd9cc..13b4dc5d 100644 --- a/src/library/maps.rs +++ b/src/library/maps.rs @@ -31,13 +31,6 @@ impl<K, V> ConsistentMap<K, V> where K: Hash + Eq { }) } - /// Add a key-spanned-value pair the value is not `None`. - pub fn add_opt_span(&mut self, key: K, value: Option<Spanned<V>>) -> ParseResult<()> { - Ok(if let Some(spanned) = value { - self.add(key, spanned.v)?; - }) - } - /// Call a function with the value if the key is present. pub fn with<F>(&self, key: K, callback: F) where F: FnOnce(&V) { if let Some(value) = self.map.get(&key) { @@ -143,7 +136,7 @@ impl PaddingMap { pub fn new(args: &mut FuncArgs, enforce: bool) -> ParseResult<PaddingMap> { let mut map = ConsistentMap::new(); - map.add_opt_span(PaddingKey::All, args.get_pos_opt::<Size>()?)?; + map.add_opt(PaddingKey::All, args.get_pos_opt::<Size>()?)?; for arg in args.keys() { let key = match PaddingKey::from_ident(&arg.v.key) { |
