cargo fmt

This commit is contained in:
Greg Shuflin 2023-02-25 02:50:43 -08:00
parent f15488194c
commit 377d515d40
2 changed files with 16 additions and 13 deletions

View File

@ -1,12 +1,12 @@
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Representation { pub struct Representation {
val: String val: String,
} }
impl Representation { impl Representation {
pub fn new(from: &str) -> Self { pub fn new(from: &str) -> Self {
Self { val: from.to_string() } Self {
val: from.to_string(),
}
} }
} }

View File

@ -50,7 +50,8 @@ where
F: Fn(&O) -> bool, F: Fn(&O) -> bool,
{ {
let orig_rep = parser.representation(); let orig_rep = parser.representation();
(move |input| { (
move |input| {
parser.parse(input).and_then(|(result, rest)| { parser.parse(input).and_then(|(result, rest)| {
if pred_fn(&result) { if pred_fn(&result) {
Ok((result, rest)) Ok((result, rest))
@ -58,7 +59,9 @@ where
Err(rest) Err(rest)
} }
}) })
}, Representation::new(&format!("{:?} if <PREDICATE>", orig_rep))) },
Representation::new(&format!("{:?} if <PREDICATE>", orig_rep)),
)
} }
/// Parses a standard identifier in a programming language /// Parses a standard identifier in a programming language