Skip to content

Commit 685e0d0

Browse files
committed
Fix warning on current Rust stable.
1 parent 9a857f7 commit 685e0d0

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/errors.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ impl From<PyParseError> for u32 {
1313

1414
#[cfg(test)]
1515
mod tests {
16-
use super::*;
1716
use nom;
1817
use nom::{Context, ErrorKind};
1918
use nom::types::CompleteStr;

src/visitors/printer.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,10 @@ fn format_string(v: &Vec<PyString>) -> String {
465465
0x9 => "\\t".to_string(),
466466
0x5c => "\\\\".to_string(),
467467
0x22 => "\\\"".to_string(),
468-
0x20...0x7e => c.to_char().unwrap().to_string(), // unwrap can't panic
469-
0x00...0x1f | 0x7f | 0x80...0xff => format!("\\x{:02x}", c.to_u32()),
470-
0x100...0xffff => format!("\\u{:04x}", c.to_u32()),
471-
0x10000...0x10ffff => format!("\\U{:08x}", c.to_u32()),
468+
0x20..=0x7e => c.to_char().unwrap().to_string(), // unwrap can't panic
469+
0x00..=0x1f | 0x7f | 0x80..=0xff => format!("\\x{:02x}", c.to_u32()),
470+
0x100..=0xffff => format!("\\u{:04x}", c.to_u32()),
471+
0x10000..=0x10ffff => format!("\\U{:08x}", c.to_u32()),
472472
_ => unreachable!(),
473473
}).collect::<Vec<_>>()[..].concat())
474474
))
@@ -512,9 +512,8 @@ fn format_expr(e: &Expression) -> String {
512512
b'\t' => "\\t".to_string(),
513513
b'\\' => "\\\\".to_string(),
514514
b'"' => "\\\"".to_string(),
515-
0x20...0x7e => (*b as char).to_string(),
516-
0x00...0x1f | 0x7f | 0x80...0xff => format!("\\x{:02x}", b),
517-
_ => unreachable!(), // waiting for https://github.com/rust-lang/rust/pull/50912
515+
0x20..=0x7e => (*b as char).to_string(),
516+
0x00..=0x1f | 0x7f | 0x80..=0xff => format!("\\x{:02x}", b),
518517
}).collect::<Vec<_>>()[..].concat())
519518
},
520519

0 commit comments

Comments
 (0)