Skip to content

Commit 217c49e

Browse files
committed
Merge pull request chris-morgan#96 from reem/format-escape
Fix for a breaking change in format! escaping.
2 parents 685fdd9 + bb9d296 commit 217c49e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/codegen/branchify.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub fn generate_branchified_method(
100100
)
101101
for &c in branch.matches.iter() {
102102
let next_prefix = format!("{}{}", prefix, c as char);
103-
w!(format!("Ok(b) if b == '{}' as u8 => match {} \\{", c as char, read_call));
103+
w!(format!("Ok(b) if b == '{}' as u8 => match {} {{", c as char, read_call));
104104
for b in branch.children.iter() {
105105
try!(r(writer, b, next_prefix.as_slice(), indent + 1, read_call, end, max_len, valid, unknown));
106106
}
@@ -124,7 +124,7 @@ pub fn generate_branchified_method(
124124
}
125125
)
126126

127-
w!(format!("let (s, next_byte) = match {} \\{", read_call));
127+
w!(format!("let (s, next_byte) = match {} {{", read_call));
128128
for b in branches.iter() {
129129
try!(r(writer, b, "", indent + 1, read_call, end, max_len, valid, unknown));
130130
}
@@ -136,10 +136,10 @@ pub fn generate_branchified_method(
136136
w!( ("let mut s = String::from_str(s);"));
137137
w!( ("s.push_char(next_byte as char);"));
138138
w!( ("loop {"));
139-
w!(format!(" match {} \\{", read_call));
139+
w!(format!(" match {} {{", read_call));
140140
w!(format!(" Ok(b) if b == {} => return Ok({}),", end, unknown.replace("{}", "s")));
141-
w!(format!(" Ok(b) if {} => \\{", valid));
142-
w!(format!(" if s.len() == {} \\{", max_len));
141+
w!(format!(" Ok(b) if {} => {{", valid));
142+
w!(format!(" if s.len() == {} {{", max_len));
143143
w!( (" // Too long; bad request"));
144144
w!( (" return Err(::std::io::IoError { kind: ::std::io::OtherIoError, desc: \"too long, bad request\", detail: None });"));
145145
w!( (" }"));

0 commit comments

Comments
 (0)