diff options
author | Nadrieril | 2019-04-08 18:23:55 +0200 |
---|---|---|
committer | Nadrieril | 2019-04-08 18:23:55 +0200 |
commit | 47c0a3ca296a9b775275c2c7118a172b9f0bcc54 (patch) | |
tree | c84f253528fdbea2f7d14aac1c909ec51c7b3184 /abnf_to_pest | |
parent | 00fa24b851ff6337cf4c5c63f82d95488180a413 (diff) |
clippy
Diffstat (limited to '')
-rw-r--r-- | abnf_to_pest/src/lib.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/abnf_to_pest/src/lib.rs b/abnf_to_pest/src/lib.rs index b2fcbbd..88f5930 100644 --- a/abnf_to_pest/src/lib.rs +++ b/abnf_to_pest/src/lib.rs @@ -81,9 +81,11 @@ impl Pretty for Range { use abnf::abnf::Range::*; Doc::text(match self { Range(x, y) => { - format!("'{}'..'{}'", format_char(x), format_char(y)) + format!("'{}'..'{}'", format_char(*x), format_char(*y)) + } + OneOf(v) => { + format!("\"{}\"", v.iter().map(|x| format_char(*x)).join("")) } - OneOf(v) => format!("\"{}\"", v.iter().map(format_char).join("")), }) } } @@ -105,9 +107,9 @@ pub fn escape_rulename(x: &str) -> String { } } -fn format_char(x: &u64) -> String { - if *x <= u64::from(u8::max_value()) { - let x: u8 = *x as u8; +fn format_char(x: u64) -> String { + if x <= u64::from(u8::max_value()) { + let x: u8 = x as u8; if x.is_ascii_graphic() { let x: char = x as char; if x != '"' && x != '\'' && x != '\\' { |