Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d6dcfb2

Browse files
committed
fix: typo in README
1 parent f2033db commit d6dcfb2

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ let html: &str = r#"
5050
let tree: Html = Html::parse(html).expect("Invalid HTML");
5151

5252
// Now you can use it!
53-
// Beware, this doesn't always work as you can have ways to write the same HTML.
53+
// Beware, this doesn't always work as you can have
54+
// difference ways to write the same HTML.
5455
assert!(format!("{tree}") == html);
5556
```
5657

@@ -81,10 +82,10 @@ let html: &str = r##"
8182
let filter = Filter::new().tag_name("li");
8283

8384
// Parse your HTML
84-
let filtered_tree: Html = Html::parse(html).expect("Invalid HTML").filter(&filter);
85+
let filtered: Html = Html::parse(html).expect("Invalid HTML").filter(&filter);
8586

86-
// Check the result: filtered_tree contains the 4 lis from the above HTML string
87-
if let Html::Vec(links) = filtered_tree {
87+
// `filtered` contains the 4 `<li>`s from the above HTML string
88+
if let Html::Vec(links) = filtered {
8889
assert!(links.len() == 4)
8990
} else {
9091
unreachable!()
@@ -119,12 +120,8 @@ let filter = Filter::new().tag_name("a");
119120
let link: Html = Html::parse(html).expect("Invalid HTML").find(&filter);
120121

121122
// Check the result: link contains `<a href="/home">Home</a>`
122-
if let Html::Tag { tag, child, .. } = link {
123-
if let Html::Text(text) = *child {
124-
assert!(tag.as_name() == "a" && text == "Home");
125-
} else {
126-
unreachable!()
127-
}
123+
if let Html::Tag { tag, child, .. } = link && let Html::Text(text) = *child {
124+
assert!(tag.as_name() == "a" && text == "Home");
128125
} else {
129126
unreachable!()
130127
}
@@ -134,8 +131,8 @@ if let Html::Tag { tag, child, .. } = link {
134131

135132
Licensed under either of
136133

137-
- [Apache License, Version 2.0](LICENSE-APACHE)
138-
- [MIT license](LICENSE-MIT)
134+
- [Apache License, Version 2.0](LICENSE-APACHE)
135+
- [MIT license](LICENSE-MIT)
139136

140137
at your option.
141138

0 commit comments

Comments
 (0)