From 47c0a3ca296a9b775275c2c7118a172b9f0bcc54 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 8 Apr 2019 18:23:55 +0200 Subject: clippy --- abnf_to_pest/src/lib.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'abnf_to_pest') 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 != '\\' { -- cgit v1.2.3