fix(links): remove unecessary clone
This commit is contained in:
@@ -16,10 +16,10 @@ where
|
||||
});
|
||||
}
|
||||
|
||||
pub fn replace_links<'a>(ast: &'a Node<'a, RefCell<Ast>>, from: String, to: String) {
|
||||
pub fn replace_links<'a>(ast: &'a Node<'a, RefCell<Ast>>, from: &'a str, to: &'a str) {
|
||||
iterate_links(ast, |l| {
|
||||
if l.url == from {
|
||||
l.url = String::from(&to)
|
||||
l.url = String::from(to)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ fn main() {
|
||||
LinksCommands::Replace { replace } => {
|
||||
replace
|
||||
.chunks(2)
|
||||
.for_each(|p| links::replace_links(ast, p[0].clone(), p[1].clone()));
|
||||
.for_each(|p| links::replace_links(ast, &p[0], &p[1]));
|
||||
cli::ResultType::Markdown(ast)
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user