fix(links): remove unecessary clone

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-05-01 17:01:47 -03:00
parent 0366ba6de5
commit 400ec56531
2 changed files with 3 additions and 3 deletions

View File

@@ -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)
}
});
}

View File

@@ -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)
}
},