Update the Inst::name() function to be const

This can be `const` because it just returns a static string value.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-11-10 19:17:27 -08:00
parent 53feed7eab
commit a9d59be472

View File

@@ -69,7 +69,8 @@ pub enum Inst {
// impl Inst
//
impl Inst {
pub fn name(&self) -> &'static str {
/// Gets the printable name of this instruction.
pub const fn name(&self) -> &'static str {
match self {
Inst::PushSym(_) => "PUSH_SYM",
Inst::PushConst(_) => "PUSH_CONST",