Fix warnings
This commit is contained in:
parent
9019e1e5a7
commit
08909d76ee
@ -25,8 +25,8 @@ impl<'a> Scope<'a> {
|
|||||||
self.named_vars.get(name)
|
self.named_vars.get(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set(&mut self, name: &String, val: Value) -> Result<(), ()> {
|
pub fn set(&mut self, name: &str, val: Value) -> Result<(), ()> {
|
||||||
if let hash_map::Entry::Vacant(e) = self.named_vars.entry(name.clone()) {
|
if let hash_map::Entry::Vacant(e) = self.named_vars.entry(name.to_owned()) {
|
||||||
e.insert(val);
|
e.insert(val);
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
@ -86,8 +86,8 @@ impl Expression {
|
|||||||
},
|
},
|
||||||
BlockExpr(_) => panic!("Not implemented!"),
|
BlockExpr(_) => panic!("Not implemented!"),
|
||||||
FunctionCall(_) => panic!("Not implemented!"),
|
FunctionCall(_) => panic!("Not implemented!"),
|
||||||
VariableName(name) => scope.get(&name).cloned().unwrap(),
|
VariableName(name) => scope.get(name).cloned().unwrap(),
|
||||||
Literal(lit) => scope.block.get_const(&lit),
|
Literal(lit) => scope.block.get_const(lit),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::{fmt::Debug, iter::Peekable, str::Chars};
|
use std::{fmt::Debug, str::Chars};
|
||||||
|
|
||||||
static DECIMAL_NUMERICS: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
static DECIMAL_NUMERICS: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
||||||
|
|
||||||
@ -71,8 +71,6 @@ impl Debug for FullToken {
|
|||||||
|
|
||||||
pub type Position = (u32, u32);
|
pub type Position = (u32, u32);
|
||||||
|
|
||||||
const EOF_CHAR: char = '\0';
|
|
||||||
|
|
||||||
pub struct Cursor<'a> {
|
pub struct Cursor<'a> {
|
||||||
pub position: Position,
|
pub position: Position,
|
||||||
char_stream: Chars<'a>,
|
char_stream: Chars<'a>,
|
||||||
@ -94,6 +92,7 @@ impl<'a> Cursor<'a> {
|
|||||||
self.char_stream.clone().next()
|
self.char_stream.clone().next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)] // Is this actually needed?
|
||||||
fn second(&mut self) -> Option<char> {
|
fn second(&mut self) -> Option<char> {
|
||||||
// `.next()` optimizes better than `.nth(1)`
|
// `.next()` optimizes better than `.nth(1)`
|
||||||
let mut stream = self.char_stream.clone();
|
let mut stream = self.char_stream.clone();
|
||||||
|
Loading…
Reference in New Issue
Block a user