Don't use trim() and unnecessary lazy evaluation
This commit is contained in:
parent
587516ff79
commit
66e71dafb8
|
@ -103,9 +103,11 @@ where
|
||||||
.ok()
|
.ok()
|
||||||
.map(|bol| (bol, mt.start(), mt.end()))
|
.map(|bol| (bol, mt.start(), mt.end()))
|
||||||
})
|
})
|
||||||
.map(|(bol, st, ed)| bol.replace_all(new_content.as_str(), &s[st..ed]))
|
.map(|(bol, st, ed)| {
|
||||||
.map(|cow| String::from(cow.trim()))
|
(bol.replace_all(new_content.as_str(), &s[st..ed]), ed - st)
|
||||||
.unwrap_or_else(|| new_content);
|
})
|
||||||
|
.map(|(cow, skip)| String::from(&cow[skip..]))
|
||||||
|
.unwrap_or(new_content);
|
||||||
|
|
||||||
if depth < MAX_LINK_NESTED_DEPTH {
|
if depth < MAX_LINK_NESTED_DEPTH {
|
||||||
if let Some(rel_path) = link.link_type.relative_path(path) {
|
if let Some(rel_path) = link.link_type.relative_path(path) {
|
||||||
|
|
Loading…
Reference in New Issue