diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2021-11-25 09:41:41 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2021-11-25 19:01:31 +0200 |
| commit | c04609bcdb7c7952501ddffc82fb97246ae0f6d4 (patch) | |
| tree | ffe56c8be1a218eac78733458b91563829c84f45 /src/builtins.rs | |
| parent | adbca5c121caaa7ed041a4b1bd9f2a2ac6981af7 (diff) | |
Implement clippy lint suggestions
Diffstat (limited to 'src/builtins.rs')
| -rw-r--r-- | src/builtins.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/builtins.rs b/src/builtins.rs index 390a213..7b06864 100644 --- a/src/builtins.rs +++ b/src/builtins.rs @@ -1,4 +1,3 @@ -use super::ast; use super::runtime::{advance_v, Term, Value}; use super::*; use std::fmt; @@ -14,9 +13,9 @@ pub struct Builtin { impl Builtin { pub fn new(identifier: &'static str, n_arguments: usize) -> Builtin { Builtin { - identifier: identifier, + identifier, arguments: vec![], - n_arguments: n_arguments, + n_arguments, } } @@ -92,8 +91,8 @@ pub const B_INTEGER_DIVIDE: &str = "int.div"; pub const B_STRING_EQ: &str = "string.eq?"; pub const B_BOOL_TO_STRING: &str = "bool.to-string"; -pub fn try_ast_symbol_to_builtin_term(symbol: &ast::Symbol) -> Option<Term> { - let builtin = match symbol.as_str() { +pub fn try_ast_symbol_to_builtin_term(symbol: &str) -> Option<Term> { + let builtin = match symbol { "true" => return Some(make_boolean_true_function()), "false" => return Some(make_boolean_false_function()), "id" => return Some(make_identity_function()), |
