delete '+' replacement and use cargo fmt to format

This commit is contained in:
Evian-Zhang 2020-08-08 15:13:22 +08:00
parent 60be20a783
commit 9d5c454e47
1 changed files with 4 additions and 10 deletions

View File

@ -333,7 +333,7 @@ impl<'a> SummaryParser<'a> {
/// Finishes parsing a link once the `Event::Start(Tag::Link(..))` has been opened. /// Finishes parsing a link once the `Event::Start(Tag::Link(..))` has been opened.
fn parse_link(&mut self, href: String) -> Link { fn parse_link(&mut self, href: String) -> Link {
let href = href.replace("%20", " ").replace("+", " "); let href = href.replace("%20", " ");
let link_content = collect_events!(self.stream, end Tag::Link(..)); let link_content = collect_events!(self.stream, end Tag::Link(..));
let name = stringify_events(link_content); let name = stringify_events(link_content);
@ -951,7 +951,7 @@ mod tests {
#[test] #[test]
fn allow_space_in_link_destination() { fn allow_space_in_link_destination() {
let src = "- [test1](./test%20link1.md)\n- [test2](./test+link2.md)\n- [test3](<./test link3.md>)"; let src = "- [test1](./test%20link1.md)\n- [test2](<./test link2.md>)";
let should_be = vec![ let should_be = vec![
SummaryItem::Link(Link { SummaryItem::Link(Link {
name: String::from("test1"), name: String::from("test1"),
@ -965,12 +965,6 @@ mod tests {
number: Some(SectionNumber(vec![2])), number: Some(SectionNumber(vec![2])),
nested_items: Vec::new(), nested_items: Vec::new(),
}), }),
SummaryItem::Link(Link {
name: String::from("test3"),
location: Some(PathBuf::from("./test link3.md")),
number: Some(SectionNumber(vec![3])),
nested_items: Vec::new(),
}),
]; ];
let mut parser = SummaryParser::new(src); let mut parser = SummaryParser::new(src);
let got = parser let got = parser