simplification of autocomplete code

This commit is contained in:
Simon Gardling
2022-04-04 17:39:30 -04:00
parent 6041da764b
commit e427e7a04e
2 changed files with 47 additions and 62 deletions

View File

@@ -79,28 +79,9 @@ impl HintEnum<'static> {
}
}
pub fn is_multi(&self) -> bool { matches!(self, HintEnum::Many(_)) }
pub fn ensure_many(&self) -> &[&str] {
match self {
HintEnum::Many(data) => data,
_ => panic!("ensure_many called on non-Many value"),
}
}
pub fn is_some(&self) -> bool { !matches!(self, HintEnum::None) }
pub fn is_none(&self) -> bool { !self.is_some() }
#[allow(dead_code)]
pub fn ensure_single(&self) -> &&str {
match self {
HintEnum::Single(data) => data,
_ => panic!("ensure_single called on non-Single value"),
}
}
#[allow(dead_code)]
pub fn is_single(&self) -> bool { !self.is_multi() }
}
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));