Skip to content

Commit

Permalink
Fix warning on current Rust stable.
Browse files Browse the repository at this point in the history
  • Loading branch information
progval committed Sep 8, 2020
1 parent 9a857f7 commit 685e0d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ impl From<PyParseError> for u32 {

#[cfg(test)]
mod tests {
use super::*;
use nom;
use nom::{Context, ErrorKind};
use nom::types::CompleteStr;
Expand Down
13 changes: 6 additions & 7 deletions src/visitors/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,10 @@ fn format_string(v: &Vec<PyString>) -> String {
0x9 => "\\t".to_string(),
0x5c => "\\\\".to_string(),
0x22 => "\\\"".to_string(),
0x20...0x7e => c.to_char().unwrap().to_string(), // unwrap can't panic
0x00...0x1f | 0x7f | 0x80...0xff => format!("\\x{:02x}", c.to_u32()),
0x100...0xffff => format!("\\u{:04x}", c.to_u32()),
0x10000...0x10ffff => format!("\\U{:08x}", c.to_u32()),
0x20..=0x7e => c.to_char().unwrap().to_string(), // unwrap can't panic
0x00..=0x1f | 0x7f | 0x80..=0xff => format!("\\x{:02x}", c.to_u32()),
0x100..=0xffff => format!("\\u{:04x}", c.to_u32()),
0x10000..=0x10ffff => format!("\\U{:08x}", c.to_u32()),
_ => unreachable!(),
}).collect::<Vec<_>>()[..].concat())
))
Expand Down Expand Up @@ -512,9 +512,8 @@ fn format_expr(e: &Expression) -> String {
b'\t' => "\\t".to_string(),
b'\\' => "\\\\".to_string(),
b'"' => "\\\"".to_string(),
0x20...0x7e => (*b as char).to_string(),
0x00...0x1f | 0x7f | 0x80...0xff => format!("\\x{:02x}", b),
_ => unreachable!(), // waiting for https://github.com/rust-lang/rust/pull/50912
0x20..=0x7e => (*b as char).to_string(),
0x00..=0x1f | 0x7f | 0x80..=0xff => format!("\\x{:02x}", b),
}).collect::<Vec<_>>()[..].concat())
},

Expand Down

0 comments on commit 685e0d0

Please sign in to comment.