Run clippy
This commit is contained in:
+6
-9
@@ -97,7 +97,7 @@ fn to_bf(rule: Rule, operand: &str, state: &mut State, out: &mut Builder) {
|
|||||||
let memcell = state
|
let memcell = state
|
||||||
.variables
|
.variables
|
||||||
.get(variable_name)
|
.get(variable_name)
|
||||||
.ok_or_else(|| format!("Variable '{}' did not exists", variable_name))
|
.ok_or_else(|| format!("Variable '{variable_name}' did not exists"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
state.free_list.push(memcell.address);
|
state.free_list.push(memcell.address);
|
||||||
state.variables.remove(&String::from(variable_name));
|
state.variables.remove(&String::from(variable_name));
|
||||||
@@ -215,7 +215,7 @@ fn instruct(statement: Pair<Rule>, state: &mut State, out: &mut Builder) {
|
|||||||
Rule::include => {
|
Rule::include => {
|
||||||
let file_path_raw = extract_operand(statement);
|
let file_path_raw = extract_operand(statement);
|
||||||
let file_path = &file_path_raw[1..file_path_raw.len() - 1];
|
let file_path = &file_path_raw[1..file_path_raw.len() - 1];
|
||||||
let content = std::fs::read_to_string(&file_path).unwrap();
|
let content = std::fs::read_to_string(file_path).unwrap();
|
||||||
let parsed_file = MblfParser::parse(Rule::file, &content)
|
let parsed_file = MblfParser::parse(Rule::file, &content)
|
||||||
.expect("Parse Error")
|
.expect("Parse Error")
|
||||||
.next()
|
.next()
|
||||||
@@ -270,15 +270,12 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_constant() {
|
fn test_parse_constant() {
|
||||||
assert_eq!(parse_constant(&"42"), Ok(42));
|
assert_eq!(parse_constant("42"), Ok(42));
|
||||||
assert_eq!(parse_constant(&"0x2A"), Ok(42));
|
assert_eq!(parse_constant("0x2A"), Ok(42));
|
||||||
assert_eq!(parse_constant(&"\"*\""), Ok(42));
|
assert_eq!(parse_constant("\"*\""), Ok(42));
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
matches!(
|
matches!(parse_constant("\'*\'"), Err(std::num::ParseIntError { .. })),
|
||||||
parse_constant(&"\'*\'"),
|
|
||||||
Err(std::num::ParseIntError { .. })
|
|
||||||
),
|
|
||||||
"Char literals are declared with \"_\", not \'_\'"
|
"Char literals are declared with \"_\", not \'_\'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user