Skip to content
This repository was archived by the owner on May 30, 2022. It is now read-only.

Commit 0a0469e

Browse files
committed
Fix compilation warnings
1 parent b8476c7 commit 0a0469e

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

examples/nested_readers.rs

+2
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ fn main() -> Result<(), fast_xml::Error> {
6565
assert_eq!(found_tables.len(), 2);
6666
// pretty print the table
6767
println!("{:#?}", found_tables);
68+
assert_eq!(found_tables[0].index, 2);
6869
assert_eq!(found_tables[0].rows.len(), 2);
6970
assert_eq!(found_tables[0].rows[0].len(), 4);
7071
assert_eq!(found_tables[0].rows[1].len(), 4);
7172

73+
assert_eq!(found_tables[1].index, 2);
7274
assert_eq!(found_tables[1].rows.len(), 2);
7375
assert_eq!(found_tables[1].rows[0].len(), 4);
7476
assert_eq!(found_tables[1].rows[1].len(), 4);

src/events/attributes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<'a> Attribute<'a> {
143143
/// instead use one of:
144144
///
145145
/// * [`Reader::decode()`], as it only allocates when the decoding can't be performed otherwise.
146-
/// * [`unescaped_value()`], as it doesn't allocate when no escape sequences are used.
146+
/// * [`unescaped_value_with_custom_entities()`], as it doesn't allocate when no escape sequences are used.
147147
///
148148
/// [`unescaped_value_with_custom_entities()`]: #method.unescaped_value_with_custom_entities
149149
/// [`Reader::decode()`]: ../../reader/struct.Reader.html#method.decode

tests/test.rs

+20-5
Original file line numberDiff line numberDiff line change
@@ -1226,20 +1226,27 @@ fn test_issue299() -> Result<(), Error> {
12261226
fn test_issue305_unflatten_namespace() -> Result<(), fast_xml::DeError> {
12271227
use fast_xml::de::from_str;
12281228

1229-
#[derive(Deserialize, Debug)]
1229+
#[derive(Deserialize, Debug, PartialEq)]
12301230
struct NamespaceBug {
12311231
#[serde(rename = "$unflatten=d:test2")]
12321232
test2: String,
12331233
}
12341234

1235-
let _namespace_bug: NamespaceBug = from_str(
1235+
let namespace_bug: NamespaceBug = from_str(
12361236
r#"
12371237
<?xml version="1.0" encoding="UTF-8"?>
12381238
<d:test xmlns:d="works">
12391239
<d:test2>doesntwork</d:test2>
12401240
</d:test>"#,
12411241
)?;
12421242

1243+
assert_eq!(
1244+
namespace_bug,
1245+
NamespaceBug {
1246+
test2: "doesntwork".into(),
1247+
}
1248+
);
1249+
12431250
Ok(())
12441251
}
12451252

@@ -1248,10 +1255,10 @@ fn test_issue305_unflatten_namespace() -> Result<(), fast_xml::DeError> {
12481255
fn test_issue305_unflatten_nesting() -> Result<(), fast_xml::DeError> {
12491256
use fast_xml::de::from_str;
12501257

1251-
#[derive(Deserialize, Debug)]
1258+
#[derive(Deserialize, Debug, PartialEq)]
12521259
struct InnerNestingBug {}
12531260

1254-
#[derive(Deserialize, Debug)]
1261+
#[derive(Deserialize, Debug, PartialEq)]
12551262
struct NestingBug {
12561263
// comment out one of these fields and it works
12571264
#[serde(rename = "$unflatten=outer1")]
@@ -1261,7 +1268,7 @@ fn test_issue305_unflatten_nesting() -> Result<(), fast_xml::DeError> {
12611268
outer2: String,
12621269
}
12631270

1264-
let _nesting_bug: NestingBug = from_str::<NestingBug>(
1271+
let nesting_bug: NestingBug = from_str::<NestingBug>(
12651272
r#"
12661273
<?xml version="1.0" encoding="UTF-8"?>
12671274
<root>
@@ -1270,5 +1277,13 @@ fn test_issue305_unflatten_nesting() -> Result<(), fast_xml::DeError> {
12701277
</root>"#,
12711278
)?;
12721279

1280+
assert_eq!(
1281+
nesting_bug,
1282+
NestingBug {
1283+
outer1: InnerNestingBug {},
1284+
outer2: "".into(),
1285+
}
1286+
);
1287+
12731288
Ok(())
12741289
}

0 commit comments

Comments
 (0)