Skip to content

Commit 9638c89

Browse files
committed
Fix build with Rust 1.32.0.
1 parent 6f57d5a commit 9638c89

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/objects/string.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,12 @@ mod test {
618618
let py_string = py.eval("u'x=\\u00e4'", None, None).unwrap();
619619
let data = py_string.cast_as::<PyString>(py).unwrap().data(py);
620620
#[cfg(feature = "python3-sys")]
621-
if let PyStringData::Latin1(s) = data {
622-
assert_eq!([b'x', b'=', 0xe4], *s);
623-
} else {
624-
panic!("Expected PyStringData::Latin1");
621+
{
622+
if let PyStringData::Latin1(s) = data {
623+
assert_eq!([b'x', b'=', 0xe4], *s);
624+
} else {
625+
panic!("Expected PyStringData::Latin1");
626+
}
625627
}
626628
assert_eq!("x=ä", py_string.extract::<String>(py).unwrap());
627629
}
@@ -633,10 +635,12 @@ mod test {
633635
let py_string = py.eval("u'x=\\ud800'", None, None).unwrap();
634636
let data = py_string.cast_as::<PyString>(py).unwrap().data(py);
635637
#[cfg(feature = "python3-sys")]
636-
if let PyStringData::Utf16(s) = data {
637-
assert_eq!(['x' as u16, '=' as u16, 0xd800], *s);
638-
} else {
639-
panic!("Expected PyStringData::Utf16");
638+
{
639+
if let PyStringData::Utf16(s) = data {
640+
assert_eq!(['x' as u16, '=' as u16, 0xd800], *s);
641+
} else {
642+
panic!("Expected PyStringData::Utf16");
643+
}
640644
}
641645
assert!(py_string.extract::<String>(py).is_err());
642646
}

0 commit comments

Comments
 (0)