We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b112e46 commit 844ccfdCopy full SHA for 844ccfd
.travis.yml
@@ -1,5 +1,6 @@
1
language: rust
2
rust:
3
+ - 1.25.0
4
- stable
5
- beta
6
- nightly
src/ast.rs
@@ -99,7 +99,7 @@ pub enum Uop {
99
100
impl fmt::Display for Uop {
101
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
102
- write!(f, "{}", match self {
+ write!(f, "{}", match *self {
103
Uop::Plus => "+",
104
Uop::Minus => "-",
105
Uop::Invert => "~",
@@ -144,7 +144,7 @@ pub enum Bop {
144
145
impl fmt::Display for Bop {
146
147
148
Bop::Add => "+",
149
Bop::Sub => "-",
150
Bop::Mult => "*",
@@ -290,7 +290,7 @@ pub enum AugAssignOp {
290
291
impl fmt::Display for AugAssignOp {
292
293
294
AugAssignOp::Add => "+=",
295
AugAssignOp::Sub => "-=",
296
AugAssignOp::Mult => "*=",
src/helpers.rs
@@ -65,7 +65,7 @@ named!(pub spaces_nl<StrSpan, ()>,
65
pub fn spaces_nonl(i: StrSpan) -> Result<(StrSpan, ()), ::nom::Err<StrSpan>> {
66
let mut it = i.fragment.chars().enumerate().peekable();
67
while let Some((index, c)) = it.next() {
68
- let next_char = it.peek().map(|(_,c)|*c);
+ let next_char = it.peek().map(|&(_,c)|c);
69
match c {
70
' ' | '\t' | '\x0c' => (),
71
'\\' if next_char.unwrap_or(' ') == '\n' => {it.next();},
src/lib.rs
@@ -22,7 +22,6 @@
22
//! # Example
23
//!
24
//! ```
25
-//! extern crate python_parser;
26
//! use python_parser::ast::*;
27
//! let code = "print(2 + 3, fd=sys.stderr)";
28
//! let ast = python_parser::file_input(python_parser::make_strspan(code))
src/strings.rs
@@ -57,19 +57,13 @@ named!(escapedchar<StrSpan, Option<PyStringCodePoint>>,
57
unicode_names2::character(&name.iter().collect::<String>()).map(cp_from_char)
58
}
59
| preceded!(char!('u'), count!(one_of!("0123456789abcdefABCDEF"), 4)) => { |v: Vec<char>| {
60
- let it: Vec<u32> = v.iter().map(|c| c.to_digit(16).unwrap()).collect();
61
- if let [d1, d2, d3, d4] = &it[..] {
62
- cp_from_u32((d1 << 12) + (d2 << 8) + (d3 << 4) + d4)
63
- }
64
- else { unreachable!() }
+ let v: Vec<u32> = v.iter().map(|c| c.to_digit(16).unwrap()).collect();
+ cp_from_u32((v[0] << 12) + (v[1] << 8) + (v[2] << 4) + v[3])
}}
| preceded!(char!('U'), count!(one_of!("0123456789abcdefABCDEF"), 8)) => { |v: Vec<char>| {
- if let [d1, d2, d3, d4, d5, d6, d7, d8] = &it[..] {
- cp_from_u32((d1 << 28) + (d2 << 24) + (d3 << 20) + (d4 << 16) +
- (d5 << 12) + (d6 << 8) + (d7 << 4) + d8)
72
+ cp_from_u32((v[0] << 28) + (v[1] << 24) + (v[2] << 20) + (v[3] << 16) +
+ (v[4] << 12) + (v[5] << 8 ) + (v[6] << 4 ) + v[7])
73
74
)
75
0 commit comments