fix clippy lints
This commit is contained in:
parent
d12d129eb8
commit
dacb6e49e2
3 changed files with 6 additions and 4 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -648,7 +648,6 @@ checksum = "1ad1d488a557b235fc46dae55512ffbfc429d2482b08b4d9435ab07384ca8aec"
|
||||||
name = "simplexpr"
|
name = "simplexpr"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"codespan-reporting",
|
|
||||||
"itertools",
|
"itertools",
|
||||||
"lalrpop",
|
"lalrpop",
|
||||||
"lalrpop-util",
|
"lalrpop-util",
|
||||||
|
|
|
@ -19,12 +19,15 @@ use itertools::Itertools;
|
||||||
|
|
||||||
use lalrpop_util::lalrpop_mod;
|
use lalrpop_util::lalrpop_mod;
|
||||||
|
|
||||||
lalrpop_mod!(pub parser);
|
lalrpop_mod!(
|
||||||
|
#[allow(clippy::all)]
|
||||||
|
pub parser
|
||||||
|
);
|
||||||
|
|
||||||
pub fn parse_string(file_id: usize, s: &str) -> AstResult<Ast> {
|
pub fn parse_string(file_id: usize, s: &str) -> AstResult<Ast> {
|
||||||
let lexer = lexer::Lexer::new(file_id, s);
|
let lexer = lexer::Lexer::new(file_id, s);
|
||||||
let parser = parser::AstParser::new();
|
let parser = parser::AstParser::new();
|
||||||
Ok(parser.parse(file_id, lexer).map_err(|e| AstError::from_parse_error(file_id, e))?)
|
parser.parse(file_id, lexer).map_err(|e| AstError::from_parse_error(file_id, e))
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! test_parser {
|
macro_rules! test_parser {
|
||||||
|
|
|
@ -64,7 +64,7 @@ impl FromStr for Coords {
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
let (x, y) = s
|
let (x, y) = s
|
||||||
.split_once(|x: char| x.to_ascii_lowercase() == 'x' || x.to_ascii_lowercase() == '*')
|
.split_once(|x: char| x.to_ascii_lowercase() == 'x' || x.to_ascii_lowercase() == '*')
|
||||||
.ok_or_else(|| Error::MalformedCoords)?;
|
.ok_or(Error::MalformedCoords)?;
|
||||||
Coords::from_strs(x, y)
|
Coords::from_strs(x, y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue