Clippy, fmt, remove unused imports
This commit is contained in:
parent
dd6a64539a
commit
facd320822
28
src/basic.rs
28
src/basic.rs
@ -1,13 +1,10 @@
|
|||||||
use nom::{
|
use nom::{
|
||||||
branch::alt,
|
branch::alt,
|
||||||
bytes::complete::{escaped_transform, tag, take_until},
|
bytes::complete::{escaped_transform, tag},
|
||||||
character::{
|
character::{complete::u64 as ccu64, streaming::none_of},
|
||||||
complete::{u32 as ccu32, u64 as ccu64},
|
|
||||||
streaming::none_of,
|
|
||||||
},
|
|
||||||
combinator::{map, value},
|
combinator::{map, value},
|
||||||
multi::{many0, separated_list0},
|
multi::separated_list0,
|
||||||
sequence::{delimited, terminated, tuple},
|
sequence::{delimited, terminated},
|
||||||
IResult,
|
IResult,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -70,7 +67,7 @@ impl Program {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_line(&mut self, line: usize) {
|
pub fn jump_to_line(&mut self, line: usize) {
|
||||||
if let Some(node) = self.nodes.find_line(line) {
|
if let Some(node) = self.nodes.find_line(line) {
|
||||||
self.current = node;
|
self.current = node;
|
||||||
} else {
|
} else {
|
||||||
@ -82,15 +79,12 @@ impl Program {
|
|||||||
let mut iter = self.clone();
|
let mut iter = self.clone();
|
||||||
|
|
||||||
while let Some(node) = iter.next() {
|
while let Some(node) = iter.next() {
|
||||||
match node {
|
if let Node::Link { item, next: _ } = node {
|
||||||
Node::Link { item, next } => {
|
match item.1 {
|
||||||
match item.1 {
|
Command::Print(line) => println!("{}", line),
|
||||||
Command::Print(line) => println!("{}", line),
|
Command::GoTo(line) => iter.jump_to_line(line),
|
||||||
Command::GoTo(line) => iter.to_line(line),
|
_ => panic!("Unrecognised command"),
|
||||||
_ => panic!("Unrecognised command")
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
_ => ()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user